From 864ccc373918a9e1875a0492876e79ff8426fbed Mon Sep 17 00:00:00 2001 From: hzrd149 Date: Sat, 30 Nov 2024 16:42:39 -0600 Subject: [PATCH] small cleanup --- package.json | 4 ++-- src/classes/notifications.ts | 10 +++++++--- src/components/debug-modal/pages/cache.tsx | 11 ++++++++++- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 373c6fefe..67987e225 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "dev": "VITE_APP_VERSION=dev vite serve", "build": "tsc --project tsconfig.json && vite build", "format": "prettier --ignore-path .prettierignore -w .", - "analyze": "npx vite-bundle-visualizer -o ./stats.html", + "analyze": "pnpm dlx vite-bundle-visualizer -o ./stats.html", "build-icons": "node ./scripts/build-icons.mjs" }, "dependencies": { @@ -152,5 +152,5 @@ "type": "lightning", "url": "lightning:nostrudel@geyser.fund" }, - "packageManager": "pnpm@9.6.0" + "packageManager": "pnpm@9.14.4" } diff --git a/src/classes/notifications.ts b/src/classes/notifications.ts index 99d9e8644..a6e62f4cc 100644 --- a/src/classes/notifications.ts +++ b/src/classes/notifications.ts @@ -3,14 +3,14 @@ import { BehaviorSubject } from "rxjs"; import { map, throttleTime } from "rxjs/operators"; import { getZapPayment } from "applesauce-core/helpers"; -import { getThreadReferences, isReply, isRepost } from "../helpers/nostr/event"; +import { getContentPointers, getThreadReferences, isReply, isRepost } from "../helpers/nostr/event"; import singleEventService from "../services/single-event"; -import RelaySet from "./relay-set"; import clientRelaysService from "../services/client-relays"; import { getPubkeysMentionedInContent } from "../helpers/nostr/post"; import { TORRENT_COMMENT_KIND } from "../helpers/nostr/torrents"; import { getPubkeysFromList } from "../helpers/nostr/lists"; import { eventStore, queryStore } from "../services/event-store"; +import RelaySet from "./relay-set"; export const NotificationTypeSymbol = Symbol("notificationType"); @@ -79,7 +79,11 @@ export default class AccountNotifications { ) { // is the pubkey mentioned in any way in the content const isMentioned = getPubkeysMentionedInContent(event.content, true).includes(this.pubkey); - const isQuote = event.tags.some((t) => t[0] === "q" && t[3] === this.pubkey); + const isQuote = + event.tags.some((t) => t[0] === "q" && (t[1] === event.id || t[3] === this.pubkey)) || + getContentPointers(event.content).some( + (p) => (p.type === "nevent" && p.data.id === event.id) || (p.type === "note" && p.data === event.id), + ); if (isMentioned) e[NotificationTypeSymbol] = NotificationType.Mention; else if (isQuote) e[NotificationTypeSymbol] = NotificationType.Quote; diff --git a/src/components/debug-modal/pages/cache.tsx b/src/components/debug-modal/pages/cache.tsx index 9c4bc8113..bb0185700 100644 --- a/src/components/debug-modal/pages/cache.tsx +++ b/src/components/debug-modal/pages/cache.tsx @@ -9,6 +9,15 @@ export default function DebugEventCachePage({ event }: { event: NostrEvent }) { const fields = Object.getOwnPropertySymbols(event); const update = () => eventStore.update(event); + const renderValue = (field: symbol) => { + let value = Reflect.get(event, field); + + if (value instanceof Map) return JSON.stringify(Object.fromEntries(value.entries())); + if (value instanceof Set) return JSON.stringify(Array.from(value)); + + return JSON.stringify(value); + }; + return ( {fields.map((field) => ( @@ -17,7 +26,7 @@ export default function DebugEventCachePage({ event }: { event: NostrEvent }) { {field.description} - {JSON.stringify(Reflect.get(event, field))} + {renderValue(field)}