simplify avatar logic slightly

This commit is contained in:
Matthew Hodgson 2015-11-30 14:39:29 +00:00
parent 2002af6c7d
commit 960cc2d6b4
3 changed files with 12 additions and 50 deletions

View file

@ -15,6 +15,7 @@ limitations under the License.
*/
var React = require('react');
var MatrixClientPeg = require('../../../MatrixClientPeg');
var Avatar = require('../../../Avatar');
module.exports = React.createClass({
displayName: 'RoomAvatar',
@ -134,12 +135,7 @@ module.exports = React.createClass({
},
getFallbackAvatar: function() {
var images = [ '76cfa6', '50e2c2', 'f4c371' ];
var total = 0;
for (var i = 0; i < this.props.room.roomId.length; ++i) {
total += this.props.room.roomId.charCodeAt(i);
}
return 'img/' + images[total % images.length] + '.png';
return Avatar.defaultAvatarUrlForString(this.props.room.roomId);
},
render: function() {