From 9fc9ac31edf3c72d45adf7d8bb1794df491aaf38 Mon Sep 17 00:00:00 2001 From: hzrd149 Date: Tue, 17 Oct 2023 07:03:42 -0500 Subject: [PATCH] example note zaps event if user dose not have LN address --- .changeset/perfect-walls-jog.md | 5 +++++ src/components/note/note-zap-button.tsx | 5 +++-- src/services/settings/migrations.ts | 5 +++-- 3 files changed, 11 insertions(+), 4 deletions(-) create mode 100644 .changeset/perfect-walls-jog.md diff --git a/.changeset/perfect-walls-jog.md b/.changeset/perfect-walls-jog.md new file mode 100644 index 000000000..75f2bb5a1 --- /dev/null +++ b/.changeset/perfect-walls-jog.md @@ -0,0 +1,5 @@ +--- +"nostrudel": patch +--- + +Fix zap button on prism posts diff --git a/src/components/note/note-zap-button.tsx b/src/components/note/note-zap-button.tsx index e137cc61a..6bd0535f2 100644 --- a/src/components/note/note-zap-button.tsx +++ b/src/components/note/note-zap-button.tsx @@ -32,6 +32,7 @@ export default function NoteZapButton({ event, allowComment, showEventPreview, . }; const total = totalZaps(zaps); + const canZap = !!metadata?.allowsNostr || event.tags.some((t) => t[0] === "zap"); return ( <> @@ -43,7 +44,7 @@ export default function NoteZapButton({ event, allowComment, showEventPreview, . colorScheme={hasZapped ? "primary" : undefined} {...props} onClick={onOpen} - isDisabled={!metadata?.allowsNostr} + isDisabled={!canZap} > {readablizeSats(total / 1000)} @@ -54,7 +55,7 @@ export default function NoteZapButton({ event, allowComment, showEventPreview, . title="Zap Note" {...props} onClick={onOpen} - isDisabled={!metadata?.allowsNostr} + isDisabled={!canZap} /> )} diff --git a/src/services/settings/migrations.ts b/src/services/settings/migrations.ts index 97a6880d1..3c7df17c6 100644 --- a/src/services/settings/migrations.ts +++ b/src/services/settings/migrations.ts @@ -76,11 +76,12 @@ export const defaultSettings: AppSettings = { youtubeRedirect: undefined, }; -export function upgradeSettings(settings: { version: number }): AppSettings { +export function upgradeSettings(settings: { version: number }): AppSettings | null { if (isV0(settings)) return { ...defaultSettings, ...settings, version: 3 }; if (isV1(settings)) return { ...defaultSettings, ...settings, version: 3 }; if (isV2(settings)) return { ...defaultSettings, ...settings, version: 3 }; - return settings as AppSettings; + if (isV3(settings)) return settings; + return null; } export function parseAppSettings(event: NostrEvent): AppSettings {