diff options
author | Mark Haines <mark.haines@matrix.org> | 2014-10-27 11:14:11 +0000 |
---|---|---|
committer | Mark Haines <mark.haines@matrix.org> | 2014-10-27 11:14:11 +0000 |
commit | acb2d171e88f7e5a60f6468e5b4f39fdb1ce94a3 (patch) | |
tree | 98b171bd5303e03ee123708f6ed96932f29db558 /webclient | |
parent | Add script to hash exisitng history (diff) | |
parent | Test pyflakes jenikns integration (diff) | |
download | synapse-acb2d171e88f7e5a60f6468e5b4f39fdb1ce94a3.tar.xz |
Merge branch 'develop' into event_signing
Diffstat (limited to 'webclient')
-rw-r--r-- | webclient/components/matrix/event-handler-service.js | 6 | ||||
-rw-r--r-- | webclient/recents/recents-filter.js | 4 | ||||
-rw-r--r-- | webclient/recents/recents.html | 10 | ||||
-rw-r--r-- | webclient/room/room-controller.js | 4 | ||||
-rw-r--r-- | webclient/room/room.html | 11 |
5 files changed, 17 insertions, 18 deletions
diff --git a/webclient/components/matrix/event-handler-service.js b/webclient/components/matrix/event-handler-service.js index e990d42d05..112b3ad96c 100644 --- a/webclient/components/matrix/event-handler-service.js +++ b/webclient/components/matrix/event-handler-service.js @@ -148,10 +148,10 @@ function(matrixService, $rootScope, $q, $timeout, mPresence) { // ts is later. var latestData = true; if (!isLiveEvent) { - var eventTs = event.ts; + var eventTs = event.origin_server_ts; var storedEvent = $rootScope.events.rooms[event.room_id][event.type]; if (storedEvent) { - if (storedEvent.ts > eventTs) { + if (storedEvent.origin_server_ts > eventTs) { // ignore it, we have a newer one already. latestData = false; } @@ -256,7 +256,7 @@ function(matrixService, $rootScope, $q, $timeout, mPresence) { // could be a membership change, display name change, etc. // Find out which one. var memberChanges = undefined; - if (event.content.prev !== event.content.membership) { + if (event.prev_content && (event.prev_content.membership !== event.content.membership)) { memberChanges = "membership"; } else if (event.prev_content && (event.prev_content.displayname !== event.content.displayname)) { diff --git a/webclient/recents/recents-filter.js b/webclient/recents/recents-filter.js index 468a746b18..ef8d9897f7 100644 --- a/webclient/recents/recents-filter.js +++ b/webclient/recents/recents-filter.js @@ -59,9 +59,9 @@ angular.module('RecentsController') return 1; } else { - return lastMsgRoomB.ts - lastMsgRoomA.ts; + return lastMsgRoomB.origin_server_ts - lastMsgRoomA.origin_server_ts; } }); return filtered; }; -}]); \ No newline at end of file +}]); diff --git a/webclient/recents/recents.html b/webclient/recents/recents.html index 9cbdcd357a..a52b215c7e 100644 --- a/webclient/recents/recents.html +++ b/webclient/recents/recents.html @@ -18,7 +18,7 @@ Declaring it in this way ensures the data-binding --> {{ lastMsg = eventHandlerService.getLastMessage(room.room_id, true);"" }} - {{ (lastMsg.ts) | date:'MMM d HH:mm' }} + {{ (lastMsg.origin_server_ts) | date:'MMM d HH:mm' }} <img ng-click="leave(room.room_id); $event.stopPropagation();" src="img/close.png" width="10" height="10" style="margin-bottom: -1px; margin-left: 2px;" alt="close"/> </td> @@ -42,12 +42,12 @@ <span ng-if="lastMsg.user_id === lastMsg.state_key"> {{lastMsg.state_key | mUserDisplayName: room.room_id }} left </span> - <span ng-if="lastMsg.user_id !== lastMsg.state_key"> + <span ng-if="lastMsg.user_id !== lastMsg.state_key && lastMsg.prev_content"> {{ lastMsg.user_id | mUserDisplayName: room.room_id }} - {{ {"join": "kicked", "ban": "unbanned"}[lastMsg.content.prev] }} + {{ {"invite": "kicked", "join": "kicked", "ban": "unbanned"}[lastMsg.prev_content.membership] }} {{ lastMsg.state_key | mUserDisplayName: room.room_id }} </span> - <span ng-if="'join' === lastMsg.content.prev && lastMsg.content.reason"> + <span ng-if="lastMsg.prev_content && 'join' === lastMsg.prev_content.membership && lastMsg.content.reason"> : {{ lastMsg.content.reason }} </span> </span> @@ -55,7 +55,7 @@ {{ lastMsg.user_id | mUserDisplayName: room.room_id }} {{ {"invite": "invited", "ban": "banned"}[lastMsg.content.membership] }} {{ lastMsg.state_key | mUserDisplayName: room.room_id }} - <span ng-if="'ban' === lastMsg.content.prev && lastMsg.content.reason"> + <span ng-if="lastMsg.prev_content && 'ban' === lastMsg.prev_content.membership && lastMsg.content.reason"> : {{ lastMsg.content.reason }} </span> </span> diff --git a/webclient/room/room-controller.js b/webclient/room/room-controller.js index d8c62c231e..a1d2e87039 100644 --- a/webclient/room/room-controller.js +++ b/webclient/room/room-controller.js @@ -603,9 +603,9 @@ angular.module('RoomController', ['ngSanitize', 'matrixFilter', 'mFileInput']) var echoMessage = { content: { body: (cmd === "/me" ? args : input), - hsob_ts: new Date().getTime(), // fake a timestamp msgtype: (cmd === "/me" ? "m.emote" : "m.text"), }, + origin_server_ts: new Date().getTime(), // fake a timestamp room_id: $scope.room_id, type: "m.room.message", user_id: $scope.state.user_id, @@ -640,7 +640,7 @@ angular.module('RoomController', ['ngSanitize', 'matrixFilter', 'mFileInput']) if (echoMessage) { // Mark the message as unsent for the rest of the page life - echoMessage.content.hsob_ts = "Unsent"; + echoMessage.origin_server_ts = "Unsent"; echoMessage.echo_msg_state = "messageUnSent"; } }); diff --git a/webclient/room/room.html b/webclient/room/room.html index 79a60585a5..ce2c581903 100644 --- a/webclient/room/room.html +++ b/webclient/room/room.html @@ -68,7 +68,6 @@ ng-hide="state.permission_denied" ng-style="{ 'visibility': state.messages_visibility }" keep-scroll> - <!-- FIXME: need to have better timestamp semantics than the (msg.content.hsob_ts || msg.ts) hack below --> <table id="messageTable" infinite-scroll="paginateMore()"> <tr ng-repeat="msg in events.rooms[room_id].messages" ng-class="(events.rooms[room_id].messages[$index + 1].user_id !== msg.user_id ? 'differentUser' : '') + (msg.user_id === state.user_id ? ' mine' : '')" scroll-item> @@ -76,7 +75,7 @@ <div class="sender" ng-hide="events.rooms[room_id].messages[$index - 1].user_id === msg.user_id"> {{ msg.user_id | mUserDisplayName: room_id }}</div> <div class="timestamp" ng-class="msg.echo_msg_state"> - {{ (msg.content.hsob_ts || msg.ts) | date:'MMM d HH:mm' }} + {{ (msg.origin_server_ts) | date:'MMM d HH:mm' }} </div> </td> <td class="avatar"> @@ -92,11 +91,11 @@ <span ng-if="msg.user_id === msg.state_key"> {{ members[msg.state_key].displayname || msg.state_key }} left </span> - <span ng-if="msg.user_id !== msg.state_key"> + <span ng-if="msg.user_id !== msg.state_key && msg.prev_content"> {{ members[msg.user_id].displayname || msg.user_id }} - {{ {"join": "kicked", "ban": "unbanned"}[msg.content.prev] }} + {{ {"invite": "kicked", "join": "kicked", "ban": "unbanned"}[msg.prev_content.membership] }} {{ members[msg.state_key].displayname || msg.state_key }} - <span ng-if="'join' === msg.content.prev && msg.content.reason"> + <span ng-if="'join' === msg.prev_content.membership && msg.content.reason"> : {{ msg.content.reason }} </span> </span> @@ -106,7 +105,7 @@ {{ members[msg.user_id].displayname || msg.user_id }} {{ {"invite": "invited", "ban": "banned"}[msg.content.membership] }} {{ members[msg.state_key].displayname || msg.state_key }} - <span ng-if="'ban' === msg.content.prev && msg.content.reason"> + <span ng-if="msg.prev_content && 'ban' === msg.prev_content.membership && msg.content.reason"> : {{ msg.content.reason }} </span> </span> |