Merge pull request #2581 from matrix-org/bwindels/communitybadgefix

Fix: community badges
This commit is contained in:
Bruno Windels 2019-02-07 12:29:49 +00:00 committed by GitHub
commit 7affcf7f4c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -180,7 +180,10 @@ class TagOrderStore extends Store {
const client = MatrixClientPeg.get();
const changedBadges = {};
groupIds.forEach(groupId => {
const rooms = GroupStore.getGroupRooms(groupId).map(r => client.getRoom(r.roomId));
const rooms =
GroupStore.getGroupRooms(groupId)
.map(r => client.getRoom(r.roomId)) // to Room objects
.filter(r => r !== null && r !== undefined); // filter out rooms we haven't joined from the group
const badge = rooms && RoomNotifs.aggregateNotificationCount(rooms);
changedBadges[groupId] = (badge && badge.count !== 0) ? badge : undefined;
});