Update for new default avatar API.

pull/190/head
David Baker 2015-09-28 17:06:39 +01:00
parent c3f32b74e4
commit 7d540572fd
2 changed files with 15 additions and 10 deletions

View File

@ -19,16 +19,6 @@ limitations under the License.
var MatrixClientPeg = require('matrix-react-sdk/lib/MatrixClientPeg');
module.exports = {
avatarUrlForMember: function(member, width, height, resizeMethod) {
var url = MatrixClientPeg.get().getAvatarUrlForMember(
member, width, height, resizeMethod, false
);
if (url === null) {
url = this.defaultAvatarUrlForString(member.userId);
}
return url;
},
defaultAvatarUrlForString: function(s) {
var total = 0;
for (var i = 0; i < s.length; ++i) {

View File

@ -17,6 +17,7 @@ limitations under the License.
'use strict';
var React = require('react');
var Avatar = require('../../../../Avatar');
var MemberAvatarController = require('matrix-react-sdk/lib/controllers/atoms/MemberAvatar')
@ -24,6 +25,20 @@ module.exports = React.createClass({
displayName: 'MemberAvatar',
mixins: [MemberAvatarController],
avatarUrlForMember: function(member) {
return Avatar.avatarUrlForMember(
member,
this.props.member,
this.props.width,
this.props.height,
this.props.resizeMethod
);
},
skinnedDefaultAvatarUrl: function(member, width, height, resizeMethod) {
return Avatar.defaultAvatarUrlForString(member.userId);
},
render: function() {
return (
<img className="mx_MemberAvatar" src={this.state.imageUrl}