From 7d540572fd667330e4578d6eeb06d3b41e8d61e8 Mon Sep 17 00:00:00 2001 From: David Baker Date: Mon, 28 Sep 2015 17:06:39 +0100 Subject: [PATCH] Update for new default avatar API. --- src/Avatar.js | 10 ---------- src/skins/vector/views/atoms/MemberAvatar.js | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/Avatar.js b/src/Avatar.js index 74b279c6..a5b59a72 100644 --- a/src/Avatar.js +++ b/src/Avatar.js @@ -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) { diff --git a/src/skins/vector/views/atoms/MemberAvatar.js b/src/skins/vector/views/atoms/MemberAvatar.js index bd20723d..69652e1a 100644 --- a/src/skins/vector/views/atoms/MemberAvatar.js +++ b/src/skins/vector/views/atoms/MemberAvatar.js @@ -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 (