diff --git a/src/lib/components/Notifications.svelte b/src/lib/components/Notifications.svelte index 490021e..81fbb07 100644 --- a/src/lib/components/Notifications.svelte +++ b/src/lib/components/Notifications.svelte @@ -60,16 +60,17 @@ function verb(n: Notification): string { switch (n.kind) { + case "quote": case "reply-op": - return "replied to your discussion"; + return "replied to you in"; case "reply": - return "replied in"; + return "wrote in"; case "mention": return "mentioned you in"; case "chat-reply": return "replied to you in chat"; case "chat-mention": - return "mentioned you in chat"; + return MODE === "full" ? "mentioned you in" : "mentioned you in chat"; } } @@ -157,6 +158,14 @@ {n.title || "a discussion"} + {:else if n.kind === "chat-mention" && MODE === "full"} + {getGroupName(n.groupId)} + chat {/if}

{#if text} diff --git a/src/lib/forum/notifications.ts b/src/lib/forum/notifications.ts index bcc29a3..91e1249 100644 --- a/src/lib/forum/notifications.ts +++ b/src/lib/forum/notifications.ts @@ -3,12 +3,19 @@ import { extractMentionPubkeys } from "$lib/mentions"; import { tag, type Query } from "./query"; export type NotificationKind = - | "reply-op" // reply to a discussion the user started - | "reply" // reply in a discussion the user took part in + | "quote" // reply quoting one of the user's posts | "mention" // mentioned in a discussion reply + | "reply-op" // reply to a discussion the user started + | "reply" // reply in a discussion the user took part in, p-tag only | "chat-reply" // chat reply to the user's message | "chat-mention"; // mentioned in chat +// Everything but plain thread activity is addressed to the user. Not applied +// yet: a future setting will let users leave plain activity out of the badge. +export function isDirect(kind: NotificationKind): boolean { + return kind !== "reply"; +} + export type Notification = { id: string; kind: NotificationKind; @@ -43,11 +50,14 @@ export function parseNotification(e: Event, me: string): Notification | null { if (e.kind === 1111) { const threadId = tag(e, "E"); if (!threadId) return null; - const kind: NotificationKind = mentioned - ? "mention" - : tag(e, "P") === me - ? "reply-op" - : "reply"; + const quoted = e.tags.some((t) => t[0] === "q" && t[3] === me); + const kind: NotificationKind = quoted + ? "quote" + : mentioned + ? "mention" + : tag(e, "P") === me + ? "reply-op" + : "reply"; return { ...base, kind, threadId }; } if (e.kind === 9) {