small cleanup

This commit is contained in:
hzrd149 2024-11-30 16:42:39 -06:00
parent bff5286b94
commit 864ccc3739
3 changed files with 19 additions and 6 deletions

View File

@ -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"
}

View File

@ -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;

View File

@ -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 (
<Flex direction="column">
{fields.map((field) => (
@ -17,7 +26,7 @@ export default function DebugEventCachePage({ event }: { event: NostrEvent }) {
{field.description}
</Text>
<Code fontFamily="monospace" isTruncated>
{JSON.stringify(Reflect.get(event, field))}
{renderValue(field)}
</Code>
<CloseButton
ml="auto"