Make it easier to override default avatar urls

pull/21833/head
David Baker 2015-09-28 17:06:13 +01:00
parent 3792d5494a
commit 8af6c2275b
1 changed files with 17 additions and 4 deletions

View File

@ -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
};
}
};