mirror of
https://github.com/Novaloop-AG/healthchat-web.git
synced 2026-11-24 18:59:17 +00:00
Fix useUnreadNotifications exploding with falsey room, like in notif panel (#10030)
This commit is contained in:
committed by
GitHub
parent
e2af97c4de
commit
262c2fcff2
+6
-2
@@ -26,7 +26,7 @@ import { MatrixClientPeg } from "./MatrixClientPeg";
|
||||
import { NotificationColor } from "./stores/notifications/NotificationColor";
|
||||
import { getUnsentMessages } from "./components/structures/RoomStatusBar";
|
||||
import { doesRoomHaveUnreadMessages, doesRoomOrThreadHaveUnreadMessages } from "./Unread";
|
||||
import { getEffectiveMembership, EffectiveMembership } from "./utils/membership";
|
||||
import { EffectiveMembership, getEffectiveMembership } from "./utils/membership";
|
||||
|
||||
export enum RoomNotifState {
|
||||
AllMessagesLoud = "all_messages_loud",
|
||||
@@ -202,9 +202,13 @@ function isMuteRule(rule: IPushRule): boolean {
|
||||
}
|
||||
|
||||
export function determineUnreadState(
|
||||
room: Room,
|
||||
room?: Room,
|
||||
threadId?: string,
|
||||
): { color: NotificationColor; symbol: string | null; count: number } {
|
||||
if (!room) {
|
||||
return { symbol: null, count: 0, color: NotificationColor.None };
|
||||
}
|
||||
|
||||
if (getUnsentMessages(room, threadId).length > 0) {
|
||||
return { symbol: "!", count: 1, color: NotificationColor.Unsent };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user