Merge pull request #9 from matrix-org/develop

Fix issue with timestamps in webclient
This commit is contained in:
Erik Johnston 2014-10-18 00:25:57 +02:00
commit f05dce54a7
2 changed files with 3 additions and 4 deletions

View File

@ -603,9 +603,9 @@ angular.module('RoomController', ['ngSanitize', 'matrixFilter', 'mFileInput'])
var echoMessage = { var echoMessage = {
content: { content: {
body: (cmd === "/me" ? args : input), body: (cmd === "/me" ? args : input),
hsob_ts: new Date().getTime(), // fake a timestamp
msgtype: (cmd === "/me" ? "m.emote" : "m.text"), msgtype: (cmd === "/me" ? "m.emote" : "m.text"),
}, },
origin_server_ts: new Date().getTime(), // fake a timestamp
room_id: $scope.room_id, room_id: $scope.room_id,
type: "m.room.message", type: "m.room.message",
user_id: $scope.state.user_id, user_id: $scope.state.user_id,
@ -640,7 +640,7 @@ angular.module('RoomController', ['ngSanitize', 'matrixFilter', 'mFileInput'])
if (echoMessage) { if (echoMessage) {
// Mark the message as unsent for the rest of the page life // 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"; echoMessage.echo_msg_state = "messageUnSent";
} }
}); });

View File

@ -68,7 +68,6 @@
ng-hide="state.permission_denied" ng-hide="state.permission_denied"
ng-style="{ 'visibility': state.messages_visibility }" ng-style="{ 'visibility': state.messages_visibility }"
keep-scroll> 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()"> <table id="messageTable" infinite-scroll="paginateMore()">
<tr ng-repeat="msg in events.rooms[room_id].messages" <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> 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="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" <div class="timestamp"
ng-class="msg.echo_msg_state"> 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> </div>
</td> </td>
<td class="avatar"> <td class="avatar">