Show display name changes in the message list.
parent
176e3fd141
commit
b5c9d99424
|
@ -253,7 +253,24 @@ function(matrixService, $rootScope, $q, $timeout, mPresence) {
|
||||||
// Exception: Do not do this if the event is a room state event because such events already come
|
// Exception: Do not do this if the event is a room state event because such events already come
|
||||||
// as room messages events. Moreover, when they come as room messages events, they are relatively ordered
|
// as room messages events. Moreover, when they come as room messages events, they are relatively ordered
|
||||||
// with other other room messages
|
// with other other room messages
|
||||||
if (event.content.prev !== event.content.membership && !isStateEvent) {
|
if (!isStateEvent) {
|
||||||
|
// could be a membership change, display name change, etc.
|
||||||
|
// Find out which one.
|
||||||
|
var memberChanges = undefined;
|
||||||
|
if (event.content.prev !== event.content.membership) {
|
||||||
|
memberChanges = "membership";
|
||||||
|
}
|
||||||
|
else if (event.prev_content.displayname !==
|
||||||
|
event.content.displayname) {
|
||||||
|
memberChanges = "displayname";
|
||||||
|
}
|
||||||
|
|
||||||
|
// mark the key which changed
|
||||||
|
event.changedKey = memberChanges;
|
||||||
|
|
||||||
|
// If there was a change we want to display, dump it in the message
|
||||||
|
// list.
|
||||||
|
if (memberChanges) {
|
||||||
if (isLiveEvent) {
|
if (isLiveEvent) {
|
||||||
$rootScope.events.rooms[event.room_id].messages.push(event);
|
$rootScope.events.rooms[event.room_id].messages.push(event);
|
||||||
}
|
}
|
||||||
|
@ -261,6 +278,7 @@ function(matrixService, $rootScope, $q, $timeout, mPresence) {
|
||||||
$rootScope.events.rooms[event.room_id].messages.unshift(event);
|
$rootScope.events.rooms[event.room_id].messages.unshift(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Use data from state event or the latest data from the stream.
|
// Use data from state event or the latest data from the stream.
|
||||||
// Do not care of events that come when paginating back
|
// Do not care of events that come when paginating back
|
||||||
|
|
|
@ -77,10 +77,10 @@
|
||||||
</td>
|
</td>
|
||||||
<td ng-class="(!msg.content.membership && ('m.room.topic' !== msg.type && 'm.room.name' !== msg.type))? (msg.content.msgtype === 'm.emote' ? 'emote text' : 'text') : 'membership text'">
|
<td ng-class="(!msg.content.membership && ('m.room.topic' !== msg.type && 'm.room.name' !== msg.type))? (msg.content.msgtype === 'm.emote' ? 'emote text' : 'text') : 'membership text'">
|
||||||
<div class="bubble">
|
<div class="bubble">
|
||||||
<span ng-if="'join' === msg.content.membership">
|
<span ng-if="'join' === msg.content.membership && msg.changedKey === 'membership'">
|
||||||
{{ members[msg.state_key].displayname || msg.state_key }} joined
|
{{ members[msg.state_key].displayname || msg.state_key }} joined
|
||||||
</span>
|
</span>
|
||||||
<span ng-if="'leave' === msg.content.membership">
|
<span ng-if="'leave' === msg.content.membership && msg.changedKey === 'membership'">
|
||||||
<span ng-if="msg.user_id === msg.state_key">
|
<span ng-if="msg.user_id === msg.state_key">
|
||||||
{{ members[msg.state_key].displayname || msg.state_key }} left
|
{{ members[msg.state_key].displayname || msg.state_key }} left
|
||||||
</span>
|
</span>
|
||||||
|
@ -93,7 +93,8 @@
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
<span ng-if="'invite' === msg.content.membership || 'ban' === msg.content.membership">
|
<span ng-if="'invite' === msg.content.membership && msg.changedKey === 'membership' ||
|
||||||
|
'ban' === msg.content.membership && msg.changedKey === 'membership'">
|
||||||
{{ members[msg.user_id].displayname || msg.user_id }}
|
{{ members[msg.user_id].displayname || msg.user_id }}
|
||||||
{{ {"invite": "invited", "ban": "banned"}[msg.content.membership] }}
|
{{ {"invite": "invited", "ban": "banned"}[msg.content.membership] }}
|
||||||
{{ members[msg.state_key].displayname || msg.state_key }}
|
{{ members[msg.state_key].displayname || msg.state_key }}
|
||||||
|
@ -101,6 +102,9 @@
|
||||||
: {{ msg.content.reason }}
|
: {{ msg.content.reason }}
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
|
<span ng-if="msg.changedKey === 'displayname'">
|
||||||
|
{{ msg.user_id }} changed their display name from {{ msg.prev_content.displayname }} to {{ msg.content.displayname }}
|
||||||
|
</span>
|
||||||
|
|
||||||
<span ng-show='msg.content.msgtype === "m.emote"'
|
<span ng-show='msg.content.msgtype === "m.emote"'
|
||||||
ng-class="msg.echo_msg_state"
|
ng-class="msg.echo_msg_state"
|
||||||
|
|
Loading…
Reference in New Issue