Add image URLs to TabComplete.Entry objects
parent
4e79c3c4c8
commit
ba63b5dfff
|
@ -216,9 +216,9 @@ class TabComplete {
|
|||
}
|
||||
};
|
||||
|
||||
TabComplete.Entry = function(text, image) {
|
||||
TabComplete.Entry = function(text, imgUrl) {
|
||||
this.text = text;
|
||||
this.image = image;
|
||||
this.imgUrl = imgUrl;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -204,7 +204,7 @@ module.exports = React.createClass({
|
|||
var memberList = [];
|
||||
if (this.props.room) {
|
||||
// TODO: We should cache this list and only update it when the
|
||||
// member list changes
|
||||
// member list changes. It's also horrendous that this is done here.
|
||||
memberList = this.props.room.getJoinedMembers().sort(function(a, b) {
|
||||
var userA = a.user;
|
||||
var userB = b.user;
|
||||
|
@ -229,7 +229,15 @@ module.exports = React.createClass({
|
|||
}
|
||||
}
|
||||
}).map(function(m) {
|
||||
return new TabComplete.Entry(m.name || m.userId);
|
||||
var url = m.getAvatarUrl(
|
||||
MatrixClientPeg.get().getHomeserverUrl(), 32, 32, "crop"
|
||||
);
|
||||
return new TabComplete.Entry(
|
||||
m.name || m.userId,
|
||||
// TODO: annoying that the JS SDK can return 0-len strings when
|
||||
// it should be returning null.. can't use truthy constructs!
|
||||
url && url.length > 0 ? url : null
|
||||
);
|
||||
});
|
||||
}
|
||||
if (this.props.tabComplete) {
|
||||
|
|
|
@ -30,8 +30,14 @@ module.exports = React.createClass({
|
|||
return (
|
||||
<div>
|
||||
{this.props.entries.map(function(entry, i) {
|
||||
var image = (
|
||||
entry.imgUrl ? <img src={entry.imgUrl} /> : null
|
||||
);
|
||||
return (
|
||||
<div key={i + ""}>{entry.text}</div>
|
||||
<div key={i + ""}>
|
||||
{image}
|
||||
{entry.text}
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue