Add image URLs to TabComplete.Entry objects
This commit is contained in:
parent
4e79c3c4c8
commit
ba63b5dfff
3 changed files with 19 additions and 5 deletions
|
@ -216,9 +216,9 @@ class TabComplete {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
TabComplete.Entry = function(text, image) {
|
TabComplete.Entry = function(text, imgUrl) {
|
||||||
this.text = text;
|
this.text = text;
|
||||||
this.image = image;
|
this.imgUrl = imgUrl;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -204,7 +204,7 @@ module.exports = React.createClass({
|
||||||
var memberList = [];
|
var memberList = [];
|
||||||
if (this.props.room) {
|
if (this.props.room) {
|
||||||
// TODO: We should cache this list and only update it when the
|
// 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) {
|
memberList = this.props.room.getJoinedMembers().sort(function(a, b) {
|
||||||
var userA = a.user;
|
var userA = a.user;
|
||||||
var userB = b.user;
|
var userB = b.user;
|
||||||
|
@ -229,7 +229,15 @@ module.exports = React.createClass({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).map(function(m) {
|
}).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) {
|
if (this.props.tabComplete) {
|
||||||
|
|
|
@ -30,8 +30,14 @@ module.exports = React.createClass({
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{this.props.entries.map(function(entry, i) {
|
{this.props.entries.map(function(entry, i) {
|
||||||
|
var image = (
|
||||||
|
entry.imgUrl ? <img src={entry.imgUrl} /> : null
|
||||||
|
);
|
||||||
return (
|
return (
|
||||||
<div key={i + ""}>{entry.text}</div>
|
<div key={i + ""}>
|
||||||
|
{image}
|
||||||
|
{entry.text}
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue