forked from matrix/element-web
You can't just use React classes as normal static classes :(
This commit is contained in:
parent
e1efb165fd
commit
c5e33352b0
|
@ -23,8 +23,7 @@ var TextForEvent = require("../../../../src/TextForEvent");
|
|||
var extend = require("../../../../src/extend");
|
||||
var dis = require("../../../../src/dispatcher");
|
||||
|
||||
var ComponentBroker = require("../../../../src/ComponentBroker");
|
||||
var MemberAvatar = ComponentBroker.get("atoms/MemberAvatar");
|
||||
var Avatar = require("../../../../src/Avatar");
|
||||
|
||||
|
||||
var NotifierView = {
|
||||
|
@ -60,7 +59,9 @@ var NotifierView = {
|
|||
if (ev.getContent().body) msg = ev.getContent().body;
|
||||
}
|
||||
|
||||
var avatarUrlrl = MemberAvatar.avatarUrlForMember(ev.sender);
|
||||
var avatarUrl = Avatar.avatarUrlForMember(
|
||||
ev.sender, 40, 40, 'crop'
|
||||
);
|
||||
|
||||
var notification = new global.Notification(
|
||||
title,
|
||||
|
|
|
@ -16,7 +16,19 @@ limitations under the License.
|
|||
|
||||
'use strict';
|
||||
|
||||
var MatrixClientPeg = require('./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) {
|
|
@ -16,8 +16,7 @@ limitations under the License.
|
|||
|
||||
'use strict';
|
||||
|
||||
var MatrixClientPeg = require('../../MatrixClientPeg');
|
||||
var DefaultAvatar = require('../../DefaultAvatar');
|
||||
var Avatar = require('../../Avatar');
|
||||
|
||||
var React = require('react');
|
||||
|
||||
|
@ -37,23 +36,8 @@ module.exports = {
|
|||
}
|
||||
},
|
||||
|
||||
// takes member as an arg so it can be used if the
|
||||
// avatars are required outsode of components
|
||||
// (eg. in html5 desktop notifs)
|
||||
avatarUrlForMember: function(member) {
|
||||
var url = MatrixClientPeg.get().getAvatarUrlForMember(
|
||||
member,
|
||||
this.props.width, this.props.height, this.props.resizeMethod,
|
||||
false
|
||||
);
|
||||
if (url === null) {
|
||||
url = this.defaultAvatarUrl(member);
|
||||
}
|
||||
return url;
|
||||
},
|
||||
|
||||
defaultAvatarUrl: function(member) {
|
||||
return DefaultAvatar.defaultAvatarUrlForString(
|
||||
return Avatar.defaultAvatarUrlForString(
|
||||
member.userId
|
||||
);
|
||||
},
|
||||
|
@ -70,7 +54,11 @@ module.exports = {
|
|||
|
||||
getInitialState: function() {
|
||||
return {
|
||||
imageUrl: this.avatarUrlForMember(this.props.member)
|
||||
imageUrl: Avatar.avatarUrlForMember(
|
||||
this.props.member,
|
||||
this.props.width, this.props.height,
|
||||
this.props.resizeMethod
|
||||
)
|
||||
};
|
||||
}
|
||||
};
|
||||
|
|
|
@ -17,7 +17,7 @@ limitations under the License.
|
|||
'use strict';
|
||||
|
||||
var MatrixClientPeg = require('../../MatrixClientPeg');
|
||||
var DefaultAvatar = require('../../DefaultAvatar');
|
||||
var Avatar = require('../../Avatar');
|
||||
|
||||
module.exports = {
|
||||
getDefaultProps: function() {
|
||||
|
@ -28,9 +28,6 @@ module.exports = {
|
|||
}
|
||||
},
|
||||
|
||||
// takes member as an arg so it can be used if the
|
||||
// avatars are required outsode of components
|
||||
// (eg. in html5 desktop notifs, although this is not)
|
||||
avatarUrlForRoom: function(room) {
|
||||
var url = MatrixClientPeg.get().getAvatarUrlForRoom(
|
||||
room,
|
||||
|
@ -44,7 +41,7 @@ module.exports = {
|
|||
},
|
||||
|
||||
defaultAvatarUrl: function(room) {
|
||||
return DefaultAvatar.defaultAvatarUrlForString(
|
||||
return Avatar.defaultAvatarUrlForString(
|
||||
this.props.room.roomId
|
||||
);
|
||||
},
|
||||
|
|
|
@ -179,9 +179,10 @@ module.exports = {
|
|||
messageWrapper.addEventListener('dragleave', this.onDragLeaveOrEnd);
|
||||
messageWrapper.addEventListener('dragend', this.onDragLeaveOrEnd);
|
||||
|
||||
messageWrapper.scrollTop = messageWrapper.scrollHeight;
|
||||
//messageWrapper.scrollTop = messageWrapper.scrollHeight;
|
||||
|
||||
this.fillSpace();
|
||||
setTimeout(this.fillSpace, 50);
|
||||
//this.fillSpace();
|
||||
}
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in New Issue