public interface AvatarProvider
Invoked by Gerrit when Avatar image requests are made.
Modifier and Type | Method and Description |
---|---|
default boolean |
canSetUrl()
Indicates whether or not the provider allows to set the image URL.
|
java.lang.String |
getChangeAvatarUrl(IdentifiedUser forUser)
Gets a URL for a user to modify their avatar image.
|
java.lang.String |
getUrl(IdentifiedUser forUser,
int imageSize)
Get avatar URL.
|
default void |
setUrl(IdentifiedUser forUser,
java.lang.String url,
int imageSize)
Set the avatar image URL for specified user and specified size.
|
java.lang.String getUrl(IdentifiedUser forUser, int imageSize)
forUser
- The user for which to load an avatar imageimageSize
- A requested image size, in pixels. An imageSize of 0 indicates to use whatever
default size the provider determines. AvatarProviders may ignore the requested image size.
The web interface will resize any image to match imageSize, so ideally the provider should
return an image sized correctly.null
is
acceptable, and results in the server responding with a 404. This will hide the avatar
image in the web UI.java.lang.String getChangeAvatarUrl(IdentifiedUser forUser)
forUser
- The user wishing to change their avatar imagedefault void setUrl(IdentifiedUser forUser, java.lang.String url, int imageSize) throws java.lang.Exception
It is the default method (not interface method declaration) for back compatibility with old code.
forUser
- The user for which need to change the avatar image.url
- The avatar image URL for the specified user.imageSize
- The avatar image size in pixels. If imageSize have a zero value this indicates
to set URL for default size that provider determines.java.lang.Exception
- if an error occurred.default boolean canSetUrl()
It is the default method (not interface method declaration) for back compatibility with old code.