fix note zaps when user doesn't have LN address

This commit is contained in:
hzrd149
2023-10-17 07:03:42 -05:00
parent 9569281b6e
commit 08eb8b2c5a
3 changed files with 11 additions and 4 deletions

View File

@@ -0,0 +1,5 @@
---
"nostrudel": patch
---
Fix zap button on prism posts

View File

@@ -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)}
</Button>
@@ -54,7 +55,7 @@ export default function NoteZapButton({ event, allowComment, showEventPreview, .
title="Zap Note"
{...props}
onClick={onOpen}
isDisabled={!metadata?.allowsNostr}
isDisabled={!canZap}
/>
)}

View File

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