Added number of users in recent rooms.
This commit is contained in:
parent
83ce57302d
commit
2eaa199e6a
|
@ -76,6 +76,18 @@ angular.module('RecentsController', ['matrixService', 'matrixFilter', 'eventHand
|
||||||
if (room.messages && room.messages.chunk && room.messages.chunk[0]) {
|
if (room.messages && room.messages.chunk && room.messages.chunk[0]) {
|
||||||
$rootScope.rooms[room.room_id].lastMsg = room.messages.chunk[0];
|
$rootScope.rooms[room.room_id].lastMsg = room.messages.chunk[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var numUsersInRoom = 0;
|
||||||
|
if (room.state) {
|
||||||
|
for (var j=0; j<room.state.length; j++) {
|
||||||
|
var stateEvent = room.state[j];
|
||||||
|
if (stateEvent.type == "m.room.member" && stateEvent.content.membership == "join") {
|
||||||
|
numUsersInRoom += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$rootScope.rooms[room.room_id].numUsersInRoom = numUsersInRoom;
|
||||||
}
|
}
|
||||||
|
|
||||||
var presence = initialSyncData.data.presence;
|
var presence = initialSyncData.data.presence;
|
||||||
|
@ -83,6 +95,7 @@ angular.module('RecentsController', ['matrixService', 'matrixFilter', 'eventHand
|
||||||
eventHandlerService.handleEvent(presence[i], false);
|
eventHandlerService.handleEvent(presence[i], false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// From now, update recents from the stream
|
// From now, update recents from the stream
|
||||||
listenToEventStream();
|
listenToEventStream();
|
||||||
},
|
},
|
||||||
|
|
|
@ -8,6 +8,9 @@
|
||||||
<td class="recentsRoomName">
|
<td class="recentsRoomName">
|
||||||
{{ room.room_id | mRoomName }}
|
{{ room.room_id | mRoomName }}
|
||||||
</td>
|
</td>
|
||||||
|
<td class="recentsRoomSummaryTS">
|
||||||
|
{{ room.numUsersInRoom }} users
|
||||||
|
</td>
|
||||||
<td class="recentsRoomSummaryTS">
|
<td class="recentsRoomSummaryTS">
|
||||||
{{ (room.lastMsg.ts) | date:'MMM d HH:mm' }}
|
{{ (room.lastMsg.ts) | date:'MMM d HH:mm' }}
|
||||||
</td>
|
</td>
|
||||||
|
|
Loading…
Reference in New Issue