mirror of
https://github.com/element-hq/element-web
synced 2024-11-23 09:46:09 +03:00
Make it easier to override default avatar urls
This commit is contained in:
parent
3792d5494a
commit
8af6c2275b
1 changed files with 17 additions and 4 deletions
|
@ -35,7 +35,10 @@ module.exports = {
|
|||
}
|
||||
},
|
||||
|
||||
defaultAvatarUrl: function(member) {
|
||||
defaultAvatarUrl: function(member, width, height, resizeMethod) {
|
||||
if (this.skinnedDefaultAvatarUrl) {
|
||||
return this.skinnedDefaultAvatarUrl(member, width, height, resizeMethod);
|
||||
}
|
||||
return "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAIAAAADnC86AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAADRJREFUeNrszQENADAIACB9QjNbxSKP4eagAFnTseHFErFYLBaLxWKxWCwWi8Vi8cX4CzAABSwCRWJw31gAAAAASUVORK5CYII=";
|
||||
},
|
||||
|
||||
|
@ -50,13 +53,23 @@ module.exports = {
|
|||
},
|
||||
|
||||
getInitialState: function() {
|
||||
return {
|
||||
imageUrl: MatrixClientPeg.get().getAvatarUrlForMember(
|
||||
var url = MatrixClientPeg.get().getAvatarUrlForMember(
|
||||
this.props.member,
|
||||
this.props.width,
|
||||
this.props.height,
|
||||
this.props.resizeMethod,
|
||||
false
|
||||
);
|
||||
if (!url) {
|
||||
url = this.defaultAvatarUrl(
|
||||
this.props.member,
|
||||
this.props.width,
|
||||
this.props.height,
|
||||
this.props.resizeMethod
|
||||
)
|
||||
);
|
||||
}
|
||||
return {
|
||||
imageUrl: url
|
||||
};
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue