Fix grouping mention notifications

This commit is contained in:
Jonathan Staab 2023-09-25 15:53:44 -07:00
parent 2fa274ffee
commit b8707359ca
2 changed files with 7 additions and 5 deletions

View File

@ -54,15 +54,14 @@ export const groupNotifications = $notifications => {
// Group notifications by event
for (const ix of $notifications) {
const eventId = findReplyId(ix)
const event = $userEvents.get(eventId)
const event = $userEvents.get(findReplyId(ix))
if (reactionKinds.includes(ix.kind) && !event) {
continue
}
// Group and sort by day/event so we can group clustered reactions to the same event
const key = formatTimestampAsLocalISODate(ix.created_at).slice(0, 11) + (eventId || ix.id)
const key = formatTimestampAsLocalISODate(ix.created_at).slice(0, 11) + (event?.id || ix.id)
groups[key] = groups[key] || {key, event, interactions: []}
groups[key].interactions.push(convertZap(ix))

View File

@ -43,8 +43,11 @@ export const displayRelay = ({url}: Relay) => last(url.split("://"))
export const getRelaySearch = $relays => fuzzy($relays, {keys: ["url", "name", "description"]})
export const getSearchableRelays = $relays => {
const urls = pluck('url', $relays.filter(r => (r.info?.supported_nips || []).includes(50)))
export const getSearchableRelays = ($relays: Relay[]) => {
const urls = pluck(
"url",
$relays.filter(r => (r.info?.supported_nips || []).includes(50))
)
return uniq(env.get().SEARCH_RELAYS.concat(urls)).slice(0, 8) as string[]
}