Merge pull request #151 from ryanalexander/count-direct-messages

Treat direct messages as mention, group behavior is the same
This commit is contained in:
Paul Makles 2021-08-30 12:19:29 +01:00 committed by GitHub
commit 43010b3b72
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -240,15 +240,16 @@ export const ServerListSidebar = observer(({ unreads, lastOpened }: Props) => {
let homeUnread: "mention" | "unread" | undefined; let homeUnread: "mention" | "unread" | undefined;
let alertCount = 0; let alertCount = 0;
for (const x of channels) { for (const x of channels) {
if ( if (x.channel?.channel_type === "Group" && x.unread) {
(x.channel?.channel_type === "DirectMessage"
? x.channel?.active
: x.channel?.channel_type === "Group") &&
x.unread
) {
homeUnread = "unread"; homeUnread = "unread";
alertCount += x.alertCount ?? 0; alertCount += x.alertCount ?? 0;
} }
if (
x.channel?.channel_type === "DirectMessage" &&
x.unread &&
x.unread.length > 0
)
alertCount++;
} }
alertCount += [...client.users.values()].filter( alertCount += [...client.users.values()].filter(