order User completions by last spoken

This commit is contained in:
Aviral Dasgupta 2017-02-10 22:34:52 +05:30
parent c7d0652762
commit 0653343319
No known key found for this signature in database
GPG key ID: 5FD1E9F4FFD3DA80
5 changed files with 109 additions and 16 deletions

View file

@ -225,7 +225,7 @@ module.exports = React.createClass({
MatrixClientPeg.get().credentials.userId, 'join'
);
this._updateAutoComplete();
UserProvider.getInstance().setUserListFromRoom(this.state.room);
this.tabComplete.loadEntries(this.state.room);
}
@ -479,8 +479,7 @@ module.exports = React.createClass({
// and that has probably just changed
if (ev.sender) {
this.tabComplete.onMemberSpoke(ev.sender);
// nb. we don't need to update the new autocomplete here since
// its results are currently ordered purely by search score.
UserProvider.getInstance().onUserSpoke(ev.sender);
}
},
@ -658,7 +657,7 @@ module.exports = React.createClass({
// refresh the tab complete list
this.tabComplete.loadEntries(this.state.room);
this._updateAutoComplete();
UserProvider.getInstance().setUserListFromRoom(this.state.room);
// if we are now a member of the room, where we were not before, that
// means we have finished joining a room we were previously peeking
@ -1437,14 +1436,6 @@ module.exports = React.createClass({
}
},
_updateAutoComplete: function() {
const myUserId = MatrixClientPeg.get().credentials.userId;
const members = this.state.room.getJoinedMembers().filter(function(member) {
if (member.userId !== myUserId) return true;
});
UserProvider.getInstance().setUserList(members);
},
render: function() {
var RoomHeader = sdk.getComponent('rooms.RoomHeader');
var MessageComposer = sdk.getComponent('rooms.MessageComposer');