Bug 345826 - show Gravatar images in task editor
Summary: show Gravatar images in task editor
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Mylyn (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P2 enhancement (vote)
Target Milestone: 3.6   Edit
Assignee: Steffen Pingel CLA
QA Contact:
URL:
Whiteboard:
Keywords: noteworthy, plan
Depends on: 343602
Blocks:
  Show dependency tree
 
Reported: 2011-05-14 16:28 EDT by Steffen Pingel CLA
Modified: 2011-07-01 08:04 EDT (History)
5 users (show)

See Also:


Attachments
mylyn/context/zip (3.02 KB, application/octet-stream)
2011-05-15 17:11 EDT, Steffen Pingel CLA
no flags Details
repository settings (11.16 KB, image/png)
2011-05-30 18:06 EDT, Steffen Pingel CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Steffen Pingel CLA 2011-05-14 16:28:08 EDT
Provide support for showing an image for the task assignee in the top-right corner of the task editor. Images should be managed through the Mylyn Commons identity API which retrieves them from services such as Gravatar.
Comment 1 Steffen Pingel CLA 2011-05-15 16:11:18 EDT
A 48x48 images depicting the assignee of a bug is now shown in the top-right of the task editor if available (screenshot on bug 343602). Before we can close this we need to resolve a few open questions:

* All images are currently cached in memory in a weak hash map and discarded on shutdown. Is some sort of persistence mechanism needed to reduce network overhead and to provide offline support?
* Images get automatically enabled for all repositories that map the USER_ASSIGNED attribute. Is a setting needed to disable this for private repositories or users that get annoyed by the visual noise?
* It may be a good idea to indicate if a task is unassigned (e.g. in JIRA) by using a distinct image.

Mik and others, any thoughts on these points?
Comment 2 Steffen Pingel CLA 2011-05-15 17:11:27 EDT
Created attachment 195685 [details]
mylyn/context/zip
Comment 3 Kevin Sawicki CLA 2011-05-16 23:58:25 EDT
I would think offline support would be nice, and perhaps Gravatars should be refreshed once a day or less.
Comment 4 Steffen Pingel CLA 2011-05-17 06:01:33 EDT
+1 for offline support 

Does Gravatar support Etags? I would think that checking once a week and providing an explicit refresh (e.g. through the People view) should be sufficient. I can only speak for myself but I updated my Gravatar image once in four years.
Comment 5 David Green CLA 2011-05-17 12:27:27 EDT
After looking at @UserAttributeEditor.refresh()@ it's not clear to me how a connector would provide an Account that corresponds to the @GravatarConnector.KIND@.  From what I can see this is necessary for cases where the account identity is not an email address but the connector can provide the Gravatar hash.  Would it make sense for @UserAttributeEditor@  to attempt to adapt the task attribute to an @org.eclipse.mylyn.commons.identity.Account@?
Comment 6 David Green CLA 2011-05-17 12:29:59 EDT
(In reply to comment #1)
> * All images are currently cached in memory in a weak hash map and discarded on
> shutdown. Is some sort of persistence mechanism needed to reduce network
> overhead and to provide offline support?

+1 for offline... the task list is offline, the images should be as well.

> * Images get automatically enabled for all repositories that map the
> USER_ASSIGNED attribute. Is a setting needed to disable this for private
> repositories or users that get annoyed by the visual noise?

We should wait for feedback on this.

> * It may be a good idea to indicate if a task is unassigned (e.g. in JIRA) by
> using a distinct image.

So far, it looks great!
Comment 7 Steffen Pingel CLA 2011-05-17 16:48:46 EDT
(In reply to comment #5)
> From what I can see this is necessary for cases where
> the account identity is not an email address but the connector can provide the
> Gravatar hash.  Would it make sense for @UserAttributeEditor@  to attempt to
> adapt the task attribute to an @org.eclipse.mylyn.commons.identity.Account@?

In order to do that you could map the corresponding user through the Identity framework and manually inject the hash:

		TaskAttribute attribute = getTaskData().getRoot().getMappedAttribute(TaskAttribute.USER_ASSIGNED);
		Account account = TasksUiInternal.getAccount(attribute)
		IIdentity identity = model.getIdentity(account);
		
		// inject Gravatar hash
		identity.addAccount(Account.id("28788caf6fa6857bd8aacfb63de4fbef").kind(GravatarConnector.KIND));

Here is a standalone example:

	public static void main(String[] args) throws Exception {
		IdentityModel model = new IdentityModel(null);
		model.addConnector(new GravatarConnector());
		
		Account account = Account.id("userid").kind("connector").url("http://repository");
		IIdentity identity = model.getIdentity(account);
		
		// inject Gravatar hash
		identity.addAccount(Account.id("28788caf6fa6857bd8aacfb63de4fbef").kind(GravatarConnector.KIND));
		
		Future<IProfileImage> future = identity.requestImage(48, 48);
		System.err.println("Image: " + future.get(10, TimeUnit.SECONDS));
	}	

This has to happen prior to constructing the UserAttributeEditor. Would that work for you?

We'll need more time to figure out how to design the generic support for mapping accounts to identities. Gravatar is only one out of many sources for retrieving profile information and we want to automate mapping of scm to build to task accounts etc. as much as we can.
Comment 8 David Green CLA 2011-05-17 17:16:11 EDT
It looks like that would work as a short-term workaround.  It does use Mylyn internals which is unfortunate.  Do you have any ideas for API for creating an Account?  It looks like all of the other pieces are there.
Comment 9 Steffen Pingel CLA 2011-05-17 17:27:14 EDT
Please note that the entire identity framework is exported as x-internal at this point and I do not expect this to become public API before June 2012 (Indigo+1). You could re-implement the code in TasksUiInternal.getAccount() if you are concerned about using TasksUiInternal directly but I would not recommend that.
Comment 10 Steffen Pingel CLA 2011-05-19 18:12:46 EDT
From today's UI review:

* Move image down by 1px
* Consider using rounded corners for the border
* Consider using an orange person image for tasks assigned to me
* Provide a per repository settings for enabling Gravatar under Task Editor Settings, for now it should only be enabled for Eclipse.org by default

Proper caching and offline support will be tracked on different task and implemented later.
Comment 11 Steffen Pingel CLA 2011-05-30 18:01:42 EDT
(In reply to comment #10)
> * Move image down by 1px
> * Provide a per repository settings for enabling Gravatar under Task Editor
> Settings, for now it should only be enabled for Eclipse.org by default

Done.

> * Consider using rounded corners for the border
> * Consider using an orange person image for tasks assigned to me

Not implemented, yet. We consider this later, please file separate bugs if this important.
Comment 12 Steffen Pingel CLA 2011-05-30 18:06:24 EDT
Created attachment 196933 [details]
repository settings
Comment 13 Steffen Pingel CLA 2011-05-30 18:06:49 EDT
I am marking this bug resolved. Basic support for showing (Gr)avatar images is now available in the Task Editor.
Comment 14 Mik Kersten CLA 2011-06-29 01:22:09 EDT
Steffen: Now that we have this great feature, I'm wondering how make it easier for people to turn on.  Currently it seems that people have to turn it on manually by going to the repository settings?  In other words, are we asking all Mylyn users out there to turn on a preference?  All other tools that I know of that use Gravatar have made it a default, so should we consider doing that?  I wonder if in doing this we would need to do the work of making the image area not show up if there was no image, though I realize the partial reflow of that section of the editor could be tricky...
Comment 15 Steffen Pingel CLA 2011-07-01 08:04:23 EDT
This has also come up in bug 350272: Gravatar - enable/disable for all repositories. The reason that it is disabled by default is to avoid exposing internal email addresses without explicit consent. My sense is that it's fine to enable Gravatar for public repositories by default. To identify public repositories I would suggest that we add a new flag to the repository settings.