This commit is contained in:
2023-04-05 11:58:26 +01:00
parent 8ef20c27b3
commit 729cbe7cbb
5 changed files with 78 additions and 29 deletions

View File

@ -58,6 +58,7 @@ export function NoteCreator(props: NoteCreatorProps) {
try {
const svc = new LNURL(zapForward);
await svc.load();
extraTags = [svc.getZapTag()];
} catch {
setError(
formatMessage({
@ -66,7 +67,6 @@ export function NoteCreator(props: NoteCreatorProps) {
);
return;
}
extraTags = [["zap", zapForward]];
}
const ev = replyTo ? await publisher.reply(replyTo, note, extraTags) : await publisher.note(note, extraTags);
console.debug("Sending note: ", ev);

View File

@ -154,11 +154,16 @@ export default function NoteFooter(props: NoteFooterProps) {
}
function getLNURL() {
return ev.Tags.find(a => a.Key === "zap")?.LNURL || author?.lud16 || author?.lud06;
return ev.tags.find(a => a[0] === "zap")?.[1] || author?.lud16 || author?.lud06;
}
function getTargetName() {
return ev.Tags.find(a => a.Key === "zap")?.LNURL || author?.display_name || author?.name;
const zapTarget = ev.tags.find(a => a[0] === "zap")?.[1];
if (zapTarget) {
return new LNURL(zapTarget).name;
} else {
return author?.display_name || author?.name;
}
}
async function fastZap(e?: React.MouseEvent) {