From d6c7631dcc55459e8cea6bc620dfcdd591f186e8 Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Fri, 15 Jan 2016 17:31:32 +0000 Subject: [PATCH] Show User avatar URLs --- src/Avatar.js | 13 ++++++++++++- src/components/views/rooms/MemberTile.js | 2 +- src/components/views/rooms/UserTile.js | 7 ++++--- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/Avatar.js b/src/Avatar.js index e97ed6b673..0ef6c8d07b 100644 --- a/src/Avatar.js +++ b/src/Avatar.js @@ -15,7 +15,7 @@ limitations under the License. */ 'use strict'; - +var ContentRepo = require("matrix-js-sdk").ContentRepo; var MatrixClientPeg = require('./MatrixClientPeg'); module.exports = { @@ -37,6 +37,17 @@ module.exports = { return url; }, + avatarUrlForUser: function(user, width, height, resizeMethod) { + var url = ContentRepo.getHttpUriForMxc( + MatrixClientPeg.get().getHomeserverUrl(), user.avatarUrl, + width, height, resizeMethod + ); + if (!url || url.length === 0) { + return null; + } + return url; + }, + defaultAvatarUrlForString: function(s) { var images = [ '76cfa6', '50e2c2', 'f4c371' ]; var total = 0; diff --git a/src/components/views/rooms/MemberTile.js b/src/components/views/rooms/MemberTile.js index 304d759ea7..cb0bce839f 100644 --- a/src/components/views/rooms/MemberTile.js +++ b/src/components/views/rooms/MemberTile.js @@ -156,7 +156,7 @@ module.exports = React.createClass({ var av; if (member) { av = ( - + ); } else { diff --git a/src/components/views/rooms/UserTile.js b/src/components/views/rooms/UserTile.js index 4a06dc9bc3..3fce07b327 100644 --- a/src/components/views/rooms/UserTile.js +++ b/src/components/views/rooms/UserTile.js @@ -18,6 +18,7 @@ limitations under the License. var React = require('react'); +var Avatar = require("../../../Avatar"); var MatrixClientPeg = require('../../../MatrixClientPeg'); var sdk = require('../../../index'); var dis = require('../../../dispatcher'); @@ -106,7 +107,7 @@ module.exports = React.createClass({ ); } - var MemberAvatar = sdk.getComponent('avatars.MemberAvatar'); + var BaseAvatar = sdk.getComponent('avatars.BaseAvatar'); if (this.props.showInvite) { // TODO @@ -117,8 +118,8 @@ module.exports = React.createClass({ onClick={ this.props.onClick } onMouseEnter={ this.mouseEnter } onMouseLeave={ this.mouseLeave }>
- +
{ nameEl }