Rejig display names when paginating to lie less.

This commit is contained in:
Kegan Dougal 2014-11-04 10:18:46 +00:00
parent 43e7ad1b1c
commit 1c86ec5b8d
3 changed files with 24 additions and 13 deletions

View file

@ -45,12 +45,17 @@ angular.module('modelService', [])
addMessageEvent: function addMessageEvent(event, toFront) {
// every message must reference the RoomMember which made it *at
// that time* so things like display names display correctly.
var stateAtTheTime = toFront ? this.old_room_state : this.current_room_state;
event.room_member = stateAtTheTime.getStateEvent("m.room.member", event.user_id);
if (event.type === "m.room.member" && event.content.membership === "invite") {
// give information on both the inviter and invitee
event.__target_room_member = stateAtTheTime.getStateEvent("m.room.member", event.state_key);
}
if (toFront) {
event.room_member = this.old_room_state.getStateEvent("m.room.member", event.user_id);
this.events.unshift(event);
}
else {
event.room_member = this.current_room_state.getStateEvent("m.room.member", event.user_id);
this.events.push(event);
}
},