Apply mutes to notifications

This commit is contained in:
Jonathan Staab 2023-03-16 11:15:34 -05:00
parent 6dbaf7450a
commit b458e3b2d6
2 changed files with 5 additions and 1 deletions

View File

@ -7,6 +7,7 @@ import {getUserReadRelays} from "src/agent/relays"
import {notifications, userEvents, contacts, rooms} from "src/agent/tables"
import {watch} from "src/agent/storage"
import network from "src/agent/network"
import user from "src/agent/user"
let listener
@ -110,6 +111,8 @@ const listen = async pubkey => {
{kinds: [42], "#e": roomIds, since},
],
onChunk: async events => {
events = user.applyMutes(events)
await network.loadPeople(pluck("pubkey", events))
await processNotifications(pubkey, events)
await processMessages(pubkey, events)

View File

@ -8,6 +8,7 @@
import Content from "src/partials/Content.svelte"
import Notification from "src/views/notifications/Notification.svelte"
import {watch} from "src/agent/storage"
import user from "src/agent/user"
import {userEvents} from "src/agent/tables"
import {lastChecked} from "src/app/listener"
@ -18,7 +19,7 @@
const notifications = watch("notifications", t => {
lastChecked.update(assoc("notifications", now()))
return sortBy(e => -e.created_at, t.all())
return sortBy(e => -e.created_at, user.applyMutes(t.all()))
})
// Group notifications so we're only showing the parent once per chunk