Browse Source

fix: ComposeReply tags root event not reply

this was broken in
9730750d5f
master
DanConwayDev 2 years ago
parent
commit
34ab67cf67
No known key found for this signature in database
GPG Key ID: 68E15486D73F75E1
  1. 13
      src/lib/wrappers/ComposeReply.svelte

13
src/lib/wrappers/ComposeReply.svelte

@ -35,13 +35,14 @@
!submitted !submitted
} }
/** to get the proposal revision id rather than the root proposal */ /** to get the proposal revision id rather than the root proposal */
const getRootId = (event: NDKEvent): string | undefined => { const getRootId = (event: NDKEvent): string => {
// exclude 'a' references to repo events // exclude 'a' references to repo events
return event.tags.find( let root_tag = event.tags.find(
(t) => t[0] === 'e' && t.length === 4 && t[3] === 'root' (t) => t[0] === 'e' && t.length === 4 && t[3] === 'root'
) || event.tags.some((t) => t[0] === 't' && t[1] === 'root') )
? event.id if (root_tag) return root_tag[1]
: undefined if (event.tags.some((t) => t[0] === 't' && t[1] === 'root')) return event.id
return selected_proposal_or_issue.summary.id
} }
async function sendReply(content: string) { async function sendReply(content: string) {
@ -50,7 +51,7 @@
new_event.kind = reply_kind new_event.kind = reply_kind
new_event.tags.push([ new_event.tags.push([
'e', 'e',
getRootId(event) || selected_proposal_or_issue.summary.id, getRootId(event),
$selected_repo_event.relays[0] || '', $selected_repo_event.relays[0] || '',
'root', 'root',
]) ])

Loading…
Cancel
Save