0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-11-20 12:24:59 +01:00

Follow API renaming. state -> presence. mtime_ago -> last_active_ago

This commit is contained in:
Emmanuel ROHEE 2014-09-01 19:09:17 +02:00
parent 74cffcf51a
commit 0271e8e692
3 changed files with 15 additions and 16 deletions

View file

@ -70,7 +70,7 @@ angular.module('matrixWebClient')
}); });
filtered.sort(function (a, b) { filtered.sort(function (a, b) {
return ((a["mtime_age"] || 10e10) > (b["mtime_age"] || 10e10) ? 1 : -1); return ((a["last_active_ago"] || 10e10) > (b["last_active_ago"] || 10e10) ? 1 : -1);
}); });
return filtered; return filtered;
}; };

View file

@ -165,11 +165,11 @@ angular.module('RoomController', ['ngSanitize', 'mFileInput'])
var isNewMember = !(target_user_id in $scope.members); var isNewMember = !(target_user_id in $scope.members);
if (isNewMember) { if (isNewMember) {
// FIXME: why are we copying these fields around inside chunk? // FIXME: why are we copying these fields around inside chunk?
if ("state" in chunk.content) { if ("presence" in chunk.content) {
chunk.presenceState = chunk.content.state; // why is this renamed? chunk.presence = chunk.content.presence;
} }
if ("mtime_age" in chunk.content) { if ("last_active_ago" in chunk.content) {
chunk.mtime_age = chunk.content.mtime_age; chunk.last_active_ago = chunk.content.last_active_ago;
} }
if ("displayname" in chunk.content) { if ("displayname" in chunk.content) {
chunk.displayname = chunk.content.displayname; chunk.displayname = chunk.content.displayname;
@ -188,11 +188,11 @@ angular.module('RoomController', ['ngSanitize', 'mFileInput'])
// selectively update membership and presence else it will nuke the picture and displayname too :/ // selectively update membership and presence else it will nuke the picture and displayname too :/
var member = $scope.members[target_user_id]; var member = $scope.members[target_user_id];
member.membership = chunk.content.membership; member.membership = chunk.content.membership;
if ("state" in chunk.content) { if ("presence" in chunk.content) {
member.presenceState = chunk.content.state; member.presence = chunk.content.presence;
} }
if ("mtime_age" in chunk.content) { if ("last_active_ago" in chunk.content) {
member.mtime_age = chunk.content.mtime_age; member.last_active_ago = chunk.content.last_active_ago;
} }
} }
}; };
@ -211,13 +211,12 @@ angular.module('RoomController', ['ngSanitize', 'mFileInput'])
var member = $scope.members[chunk.content.user_id]; var member = $scope.members[chunk.content.user_id];
// XXX: why not just pass the chunk straight through? // XXX: why not just pass the chunk straight through?
if ("state" in chunk.content) { if ("presence" in chunk.content) {
member.presenceState = chunk.content.state; member.presence = chunk.content.presence;
} }
if ("mtime_age" in chunk.content) { if ("last_active_ago" in chunk.content) {
// FIXME: should probably keep updating mtime_age in realtime like FB does member.last_active_ago = chunk.content.last_active_ago;
member.mtime_age = chunk.content.mtime_age;
} }
// this may also contain a new display name or avatar url, so check. // this may also contain a new display name or avatar url, so check.

View file

@ -26,8 +26,8 @@
<img class="userAvatarGradient" src="img/gradient.png" title="{{ member.id }}" width="80" height="24"/> <img class="userAvatarGradient" src="img/gradient.png" title="{{ member.id }}" width="80" height="24"/>
<div class="userName">{{ member.displayname || member.id.substr(0, member.id.indexOf(':')) }}<br/>{{ member.displayname ? "" : member.id.substr(member.id.indexOf(':')) }}</div> <div class="userName">{{ member.displayname || member.id.substr(0, member.id.indexOf(':')) }}<br/>{{ member.displayname ? "" : member.id.substr(member.id.indexOf(':')) }}</div>
</td> </td>
<td class="userPresence" ng-class="(member.presenceState === 'online' ? 'online' : (member.presenceState === 'unavailable' ? 'unavailable' : '')) + ' ' + (member.membership == 'invite' ? 'invited' : '')"> <td class="userPresence" ng-class="(member.presence === 'online' ? 'online' : (member.presence === 'unavailable' ? 'unavailable' : '')) + ' ' + (member.membership == 'invite' ? 'invited' : '')">
<span ng-show="member.mtime_age">{{ member.mtime_age + (now - member.last_updated) | duration }}<br/>ago</span> <span ng-show="member.last_active_ago">{{ member.last_active_ago + (now - member.last_updated) | duration }}<br/>ago</span>
</td> </td>
</table> </table>
</div> </div>