mirror of
https://github.com/hzrd149/nostrudel.git
synced 2025-09-27 12:07:43 +02:00
fix note zaps when user doesn't have LN address
This commit is contained in:
5
.changeset/perfect-walls-jog.md
Normal file
5
.changeset/perfect-walls-jog.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"nostrudel": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix zap button on prism posts
|
@@ -32,6 +32,7 @@ export default function NoteZapButton({ event, allowComment, showEventPreview, .
|
|||||||
};
|
};
|
||||||
|
|
||||||
const total = totalZaps(zaps);
|
const total = totalZaps(zaps);
|
||||||
|
const canZap = !!metadata?.allowsNostr || event.tags.some((t) => t[0] === "zap");
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -43,7 +44,7 @@ export default function NoteZapButton({ event, allowComment, showEventPreview, .
|
|||||||
colorScheme={hasZapped ? "primary" : undefined}
|
colorScheme={hasZapped ? "primary" : undefined}
|
||||||
{...props}
|
{...props}
|
||||||
onClick={onOpen}
|
onClick={onOpen}
|
||||||
isDisabled={!metadata?.allowsNostr}
|
isDisabled={!canZap}
|
||||||
>
|
>
|
||||||
{readablizeSats(total / 1000)}
|
{readablizeSats(total / 1000)}
|
||||||
</Button>
|
</Button>
|
||||||
@@ -54,7 +55,7 @@ export default function NoteZapButton({ event, allowComment, showEventPreview, .
|
|||||||
title="Zap Note"
|
title="Zap Note"
|
||||||
{...props}
|
{...props}
|
||||||
onClick={onOpen}
|
onClick={onOpen}
|
||||||
isDisabled={!metadata?.allowsNostr}
|
isDisabled={!canZap}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
@@ -76,11 +76,12 @@ export const defaultSettings: AppSettings = {
|
|||||||
youtubeRedirect: undefined,
|
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 (isV0(settings)) return { ...defaultSettings, ...settings, version: 3 };
|
||||||
if (isV1(settings)) return { ...defaultSettings, ...settings, version: 3 };
|
if (isV1(settings)) return { ...defaultSettings, ...settings, version: 3 };
|
||||||
if (isV2(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 {
|
export function parseAppSettings(event: NostrEvent): AppSettings {
|
||||||
|
Reference in New Issue
Block a user