Use Diffy as avatar for the Gerrit server itself
Display Diffy as avatar for comments on changes that were created by the Gerrit server, e.g. for the comment that is created if a change needs to be rebased due to a path conflict. Change-Id: I9bdd2e356fa1562ac1a20c4c9d17a557094d9018 Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:
@@ -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 "";
|
||||
|
@@ -51,4 +51,7 @@ public interface GerritResources extends ClientBundle {
|
||||
|
||||
@Source("addFileComment.png")
|
||||
public ImageResource addFileComment();
|
||||
|
||||
@Source("diffy.png")
|
||||
public ImageResource gerritAvatar();
|
||||
}
|
||||
|
BIN
gerrit-gwtui/src/main/java/com/google/gerrit/client/diffy.png
Normal file
BIN
gerrit-gwtui/src/main/java/com/google/gerrit/client/diffy.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.7 KiB |
Reference in New Issue
Block a user