Fix some notifications

This commit is contained in:
Jon Staab 2024-06-24 14:57:45 -07:00
parent 0acf627870
commit 67fe524dd1
4 changed files with 14 additions and 6 deletions

View File

@ -16,6 +16,7 @@
import NotificationReplies from "src/app/views/NotificationReplies.svelte"
import {router} from "src/app/util/router"
import {
pubkey,
session,
settings,
markAsSeen,
@ -146,7 +147,7 @@
<div class="h-px w-full bg-neutral-600" />
</div>
{/if}
{#if !notification.event}
{#if notification.event?.pubkey !== $pubkey}
<NotificationMention {notification} />
{:else if activeTab === allTabs[0]}
<NotificationReplies {notification} />

View File

@ -1,6 +1,7 @@
<script lang="ts">
import {onMount} from "svelte"
import {pluck, identity} from "ramda"
import {pluck, equals} from "ramda"
import {identity} from "@welshman/lib"
import {MUTES} from "@welshman/util"
import {appName} from "src/partials/state"
import {showInfo} from "src/partials/Toast.svelte"
@ -28,8 +29,13 @@
const searchWords = q => pluck("name", $searchTopics(q))
const submit = () => {
if (!equals($settings, values)) {
publishSettings(values)
}
if (!equals(mutedPubkeys, Array.from($userMutes))) {
updateSingleton(MUTES, () => mutedPubkeys.map(mention))
}
showInfo("Your preferences have been saved!")
}

View File

@ -527,7 +527,7 @@ export const listenForMessages = (pubkeys: string[]) => {
forcePlatform: false,
relays: hints.Messages(pubkeys).getUrls(),
filters: [
addSinceToFilter({kinds: [WRAP], "#p": [pubkey.get()]}, seconds(7, "day")),
addSinceToFilter({kinds: [WRAP], "#p": [pubkey.get()]}, seconds(14, "day")),
addSinceToFilter({kinds: [4], authors: allPubkeys}),
addSinceToFilter({kinds: [4], "#p": allPubkeys}),
],

View File

@ -1022,6 +1022,7 @@ export const createNotificationGroups = ($notifications, kinds) => {
return e
}
const $pubkey = pubkey.get()
const groups = {}
// Group notifications by event
@ -1033,7 +1034,7 @@ export const createNotificationGroups = ($notifications, kinds) => {
const parentId = Tags.fromEvent(ix).whereKey("e").parent()?.value()
const event = parentId ? repository.getEvent(parentId) : null
if (reactionKinds.includes(ix.kind) && !event) {
if (reactionKinds.includes(ix.kind) && event?.pubkey !== $pubkey) {
continue
}