mirror of
https://github.com/element-hq/element-web
synced 2024-11-24 02:05:45 +03:00
Tidy up autocomplete updating
..into a function
This commit is contained in:
parent
7d712d06a1
commit
327015ba0f
1 changed files with 12 additions and 18 deletions
|
@ -202,13 +202,8 @@ module.exports = React.createClass({
|
||||||
MatrixClientPeg.get().credentials.userId, 'join'
|
MatrixClientPeg.get().credentials.userId, 'join'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
this._updateAutoComplete();
|
||||||
this.tabComplete.loadEntries(this.state.room);
|
this.tabComplete.loadEntries(this.state.room);
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!user_is_in_room && this.state.roomId) {
|
if (!user_is_in_room && this.state.roomId) {
|
||||||
|
@ -367,12 +362,8 @@ module.exports = React.createClass({
|
||||||
// and that has probably just changed
|
// and that has probably just changed
|
||||||
if (ev.sender) {
|
if (ev.sender) {
|
||||||
this.tabComplete.onMemberSpoke(ev.sender);
|
this.tabComplete.onMemberSpoke(ev.sender);
|
||||||
|
// nb. we don't need to update the new autocomplete here since
|
||||||
const myUserId = MatrixClientPeg.get().credentials.userId;
|
// its results are currently ordered purely by search score.
|
||||||
const members = this.state.room.getJoinedMembers().filter(function(member) {
|
|
||||||
if (member.userId !== myUserId) return true;
|
|
||||||
});
|
|
||||||
UserProvider.getInstance().setUserList(members);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -452,12 +443,7 @@ module.exports = React.createClass({
|
||||||
|
|
||||||
// a member state changed in this room, refresh the tab complete list
|
// a member state changed in this room, refresh the tab complete list
|
||||||
this.tabComplete.loadEntries(this.state.room);
|
this.tabComplete.loadEntries(this.state.room);
|
||||||
|
this._updateAutoComplete();
|
||||||
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);
|
|
||||||
|
|
||||||
// if we are now a member of the room, where we were not before, that
|
// 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
|
// means we have finished joining a room we were previously peeking
|
||||||
|
@ -1263,6 +1249,14 @@ 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() {
|
render: function() {
|
||||||
var RoomHeader = sdk.getComponent('rooms.RoomHeader');
|
var RoomHeader = sdk.getComponent('rooms.RoomHeader');
|
||||||
var MessageComposer = sdk.getComponent('rooms.MessageComposer');
|
var MessageComposer = sdk.getComponent('rooms.MessageComposer');
|
||||||
|
|
Loading…
Reference in a new issue