mirror of
https://github.com/coracle-social/flotilla.git
synced 2025-12-11 11:27:03 +00:00
Fix notification badge for global chat
This commit is contained in:
@@ -9,6 +9,7 @@ import {
|
|||||||
makeChatPath,
|
makeChatPath,
|
||||||
makeThreadPath,
|
makeThreadPath,
|
||||||
makeCalendarPath,
|
makeCalendarPath,
|
||||||
|
makeSpaceChatPath,
|
||||||
makeRoomPath,
|
makeRoomPath,
|
||||||
} from "@app/routes"
|
} from "@app/routes"
|
||||||
import {chats, getUrlsForEvent, userRoomsByUrl, repositoryStore} from "@app/state"
|
import {chats, getUrlsForEvent, userRoomsByUrl, repositoryStore} from "@app/state"
|
||||||
@@ -75,8 +76,10 @@ export const notifications = derived(
|
|||||||
const spacePath = makeSpacePath(url)
|
const spacePath = makeSpacePath(url)
|
||||||
const threadPath = makeThreadPath(url)
|
const threadPath = makeThreadPath(url)
|
||||||
const calendarPath = makeCalendarPath(url)
|
const calendarPath = makeCalendarPath(url)
|
||||||
|
const messagesPath = makeSpaceChatPath(url)
|
||||||
const threadEvents = allThreadEvents.filter(e => $getUrlsForEvent(e.id).includes(url))
|
const threadEvents = allThreadEvents.filter(e => $getUrlsForEvent(e.id).includes(url))
|
||||||
const calendarEvents = allCalendarEvents.filter(e => $getUrlsForEvent(e.id).includes(url))
|
const calendarEvents = allCalendarEvents.filter(e => $getUrlsForEvent(e.id).includes(url))
|
||||||
|
const messagesEvents = allMessageEvents.filter(e => $getUrlsForEvent(e.id).includes(url))
|
||||||
|
|
||||||
if (hasNotification(threadPath, threadEvents[0])) {
|
if (hasNotification(threadPath, threadEvents[0])) {
|
||||||
paths.add(spacePath)
|
paths.add(spacePath)
|
||||||
@@ -88,6 +91,11 @@ export const notifications = derived(
|
|||||||
paths.add(calendarPath)
|
paths.add(calendarPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (hasNotification(messagesPath, messagesEvents[0])) {
|
||||||
|
paths.add(spacePath)
|
||||||
|
paths.add(messagesPath)
|
||||||
|
}
|
||||||
|
|
||||||
const commentsByThreadId = groupBy(
|
const commentsByThreadId = groupBy(
|
||||||
e => getTagValue("E", e.tags),
|
e => getTagValue("E", e.tags),
|
||||||
threadEvents.filter(spec({kind: COMMENT})),
|
threadEvents.filter(spec({kind: COMMENT})),
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ export const makeChatPath = (pubkeys: string[]) => `/chat/${makeChatId(pubkeys)}
|
|||||||
|
|
||||||
export const makeRoomPath = (url: string, room: string) => `/spaces/${encodeRelay(url)}/${room}`
|
export const makeRoomPath = (url: string, room: string) => `/spaces/${encodeRelay(url)}/${room}`
|
||||||
|
|
||||||
|
export const makeSpaceChatPath = (url: string) => makeRoomPath(url, "chat")
|
||||||
|
|
||||||
export const makeThreadPath = (url: string, eventId?: string) =>
|
export const makeThreadPath = (url: string, eventId?: string) =>
|
||||||
makeSpacePath(url, "threads", eventId)
|
makeSpacePath(url, "threads", eventId)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user