Merge "Use Diffy as avatar for the Gerrit server itself"

This commit is contained in:
Shawn Pearce
2013-04-25 15:16:25 +00:00
committed by Gerrit Code Review
3 changed files with 15 additions and 1 deletions

View File

@@ -15,6 +15,7 @@
package com.google.gerrit.client;
import com.google.gerrit.client.account.AccountInfo;
import com.google.gerrit.client.changes.Util;
import com.google.gerrit.client.rpc.RestApi;
import com.google.gwt.event.dom.client.ErrorEvent;
import com.google.gwt.event.dom.client.ErrorHandler;
@@ -56,7 +57,8 @@ public class AvatarImage extends Image {
* avatar image
*/
public AvatarImage(AccountInfo account, int size, boolean addPopup) {
super(url(account.email(), size));
super(isGerritServer(account) ? getGerritServerAvatarUrl() :
url(account.email(), size));
if (size > 0) {
// If the provider does not resize the image, force it in the browser.
@@ -80,6 +82,15 @@ public class AvatarImage extends Image {
}
}
private static boolean isGerritServer(AccountInfo account) {
return account._account_id() == 0
&& Util.C.messageNoAuthor().equals(account.name());
}
private static String getGerritServerAvatarUrl() {
return Gerrit.RESOURCES.gerritAvatar().getSafeUri().asString();
}
private static String url(String email, int size) {
if (email == null) {
return "";

View File

@@ -51,4 +51,7 @@ public interface GerritResources extends ClientBundle {
@Source("addFileComment.png")
public ImageResource addFileComment();
@Source("diffy.png")
public ImageResource gerritAvatar();
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB