mirror of
https://github.com/SchildiChat/element-web.git
synced 2024-10-01 01:26:12 -04:00
Update for new default avatar API.
This commit is contained in:
parent
c3f32b74e4
commit
7d540572fd
@ -19,16 +19,6 @@ limitations under the License.
|
|||||||
var MatrixClientPeg = require('matrix-react-sdk/lib/MatrixClientPeg');
|
var MatrixClientPeg = require('matrix-react-sdk/lib/MatrixClientPeg');
|
||||||
|
|
||||||
module.exports = {
|
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) {
|
defaultAvatarUrlForString: function(s) {
|
||||||
var total = 0;
|
var total = 0;
|
||||||
for (var i = 0; i < s.length; ++i) {
|
for (var i = 0; i < s.length; ++i) {
|
||||||
|
@ -17,6 +17,7 @@ limitations under the License.
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var React = require('react');
|
var React = require('react');
|
||||||
|
var Avatar = require('../../../../Avatar');
|
||||||
|
|
||||||
var MemberAvatarController = require('matrix-react-sdk/lib/controllers/atoms/MemberAvatar')
|
var MemberAvatarController = require('matrix-react-sdk/lib/controllers/atoms/MemberAvatar')
|
||||||
|
|
||||||
@ -24,6 +25,20 @@ module.exports = React.createClass({
|
|||||||
displayName: 'MemberAvatar',
|
displayName: 'MemberAvatar',
|
||||||
mixins: [MemberAvatarController],
|
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() {
|
render: function() {
|
||||||
return (
|
return (
|
||||||
<img className="mx_MemberAvatar" src={this.state.imageUrl}
|
<img className="mx_MemberAvatar" src={this.state.imageUrl}
|
||||||
|
Loading…
Reference in New Issue
Block a user