You can't just use React classes as normal static classes :(
This commit is contained in:
parent
e1efb165fd
commit
c5e33352b0
5 changed files with 28 additions and 29 deletions
|
@ -23,8 +23,7 @@ var TextForEvent = require("../../../../src/TextForEvent");
|
||||||
var extend = require("../../../../src/extend");
|
var extend = require("../../../../src/extend");
|
||||||
var dis = require("../../../../src/dispatcher");
|
var dis = require("../../../../src/dispatcher");
|
||||||
|
|
||||||
var ComponentBroker = require("../../../../src/ComponentBroker");
|
var Avatar = require("../../../../src/Avatar");
|
||||||
var MemberAvatar = ComponentBroker.get("atoms/MemberAvatar");
|
|
||||||
|
|
||||||
|
|
||||||
var NotifierView = {
|
var NotifierView = {
|
||||||
|
@ -60,7 +59,9 @@ var NotifierView = {
|
||||||
if (ev.getContent().body) msg = ev.getContent().body;
|
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(
|
var notification = new global.Notification(
|
||||||
title,
|
title,
|
||||||
|
|
|
@ -16,7 +16,19 @@ limitations under the License.
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
var MatrixClientPeg = require('./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) {
|
|
@ -16,8 +16,7 @@ limitations under the License.
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var MatrixClientPeg = require('../../MatrixClientPeg');
|
var Avatar = require('../../Avatar');
|
||||||
var DefaultAvatar = require('../../DefaultAvatar');
|
|
||||||
|
|
||||||
var React = require('react');
|
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) {
|
defaultAvatarUrl: function(member) {
|
||||||
return DefaultAvatar.defaultAvatarUrlForString(
|
return Avatar.defaultAvatarUrlForString(
|
||||||
member.userId
|
member.userId
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -70,7 +54,11 @@ module.exports = {
|
||||||
|
|
||||||
getInitialState: function() {
|
getInitialState: function() {
|
||||||
return {
|
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';
|
'use strict';
|
||||||
|
|
||||||
var MatrixClientPeg = require('../../MatrixClientPeg');
|
var MatrixClientPeg = require('../../MatrixClientPeg');
|
||||||
var DefaultAvatar = require('../../DefaultAvatar');
|
var Avatar = require('../../Avatar');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
getDefaultProps: function() {
|
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) {
|
avatarUrlForRoom: function(room) {
|
||||||
var url = MatrixClientPeg.get().getAvatarUrlForRoom(
|
var url = MatrixClientPeg.get().getAvatarUrlForRoom(
|
||||||
room,
|
room,
|
||||||
|
@ -44,7 +41,7 @@ module.exports = {
|
||||||
},
|
},
|
||||||
|
|
||||||
defaultAvatarUrl: function(room) {
|
defaultAvatarUrl: function(room) {
|
||||||
return DefaultAvatar.defaultAvatarUrlForString(
|
return Avatar.defaultAvatarUrlForString(
|
||||||
this.props.room.roomId
|
this.props.room.roomId
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
|
@ -179,9 +179,10 @@ module.exports = {
|
||||||
messageWrapper.addEventListener('dragleave', this.onDragLeaveOrEnd);
|
messageWrapper.addEventListener('dragleave', this.onDragLeaveOrEnd);
|
||||||
messageWrapper.addEventListener('dragend', this.onDragLeaveOrEnd);
|
messageWrapper.addEventListener('dragend', this.onDragLeaveOrEnd);
|
||||||
|
|
||||||
messageWrapper.scrollTop = messageWrapper.scrollHeight;
|
//messageWrapper.scrollTop = messageWrapper.scrollHeight;
|
||||||
|
|
||||||
this.fillSpace();
|
setTimeout(this.fillSpace, 50);
|
||||||
|
//this.fillSpace();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue