+
+ {{ notificationCount(room) }}
{{ room.summary.info.title }}
{{ room.topic }}
@@ -22,9 +23,15 @@ export default {
name: "RoomList",
data: () => ({
- currentRoomId: -1,
+ currentRoomId: null,
}),
+ methods: {
+ notificationCount(room) {
+ return room.getUnreadNotificationCount('total') || 0;
+ }
+ },
+
watch: {
currentRoomId() {
this.$emit("close");
@@ -33,3 +40,7 @@ export default {
},
};
+
+
\ No newline at end of file
diff --git a/src/services/matrix.service.js b/src/services/matrix.service.js
index 9c4a5de..05ec052 100644
--- a/src/services/matrix.service.js
+++ b/src/services/matrix.service.js
@@ -28,6 +28,7 @@ export default {
userDisplayName: null,
userAvatar: null,
currentRoom: null,
+ notificationCount: 0
}
},
mounted() {
@@ -59,7 +60,7 @@ export default {
handler(roomId) {
this.currentRoom = this.getRoom(roomId);
}
- }
+ },
},
methods: {
@@ -274,11 +275,13 @@ export default {
}
break;
}
+ this.updateNotificationCount();
},
onRoom(ignoredroom) {
console.log("Got room: " + ignoredroom);
this.reloadRooms();
+ this.updateNotificationCount();
},
onSessionLoggedOut() {
@@ -411,7 +414,16 @@ export default {
.catch(err => {
return Promise.reject("Failed to find room: " + err);
});
+ },
+
+ updateNotificationCount() {
+ var count = 0;
+ this.rooms.forEach(room => {
+ count += room.getUnreadNotificationCount('total') || 0;
+ });
+ this.notificationCount = count;
}
+
}
})