mirror of
https://github.com/SchildiChat/element-web.git
synced 2024-10-01 01:26:12 -04:00
Do room avatars properly.
This commit is contained in:
parent
4b645bcd66
commit
08270b26ee
BIN
src/skins/vector/img/50e2c2.png
Normal file
BIN
src/skins/vector/img/50e2c2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 146 B |
BIN
src/skins/vector/img/80cef4.png
Normal file
BIN
src/skins/vector/img/80cef4.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 146 B |
BIN
src/skins/vector/img/f4c371.png
Normal file
BIN
src/skins/vector/img/f4c371.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 146 B |
@ -17,6 +17,7 @@ limitations under the License.
|
||||
'use strict';
|
||||
|
||||
var React = require('react');
|
||||
var MatrixClientPeg = require('matrix-react-sdk/lib/MatrixClientPeg');
|
||||
|
||||
var RoomAvatarController = require('matrix-react-sdk/lib/controllers/atoms/RoomAvatar')
|
||||
|
||||
@ -24,6 +25,23 @@ module.exports = React.createClass({
|
||||
displayName: 'RoomAvatar',
|
||||
mixins: [RoomAvatarController],
|
||||
|
||||
getUrlList: function() {
|
||||
return [
|
||||
this.roomAvatarUrl(),
|
||||
this.getOneToOneAvatar(),
|
||||
this.getFallbackAvatar()
|
||||
];
|
||||
},
|
||||
|
||||
getFallbackAvatar: function() {
|
||||
var images = [ '80cef4', '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';
|
||||
},
|
||||
|
||||
render: function() {
|
||||
return (
|
||||
<img className="mx_RoomAvatar" src={this.state.imageUrl} onError={this.onError}
|
||||
|
Loading…
Reference in New Issue
Block a user