Browse Source

feat: add NIP-31 alt tag to issues

and replies when we switch to the nip34 reply kind
master
DanConwayDev 2 years ago
parent
commit
cf440f6cfe
No known key found for this signature in database
GPG Key ID: 68E15486D73F75E1
  1. 8
      src/lib/wrappers/ComposeIssue.svelte
  2. 1
      src/lib/wrappers/ComposeReply.svelte

8
src/lib/wrappers/ComposeIssue.svelte

@ -17,12 +17,14 @@ @@ -17,12 +17,14 @@
edit_mode = !submitted
}
async function sendIssue(content: string) {
async function sendIssue(title: string, content: string) {
if (!$logged_in_user) await login()
if (!$logged_in_user) return
let event = new NDKEvent(ndk)
event.kind = issue_kind
event.tags.push(['alt', `git repository issue: ${title}`])
if (repo_event.unique_commit) {
event.tags.push(['r', repo_event.unique_commit])
}
@ -33,7 +35,7 @@ @@ -33,7 +35,7 @@
'root',
])
repo_event.maintainers.forEach((m) => event.tags.push(['p', m]))
event.content = content
event.content = `${title}\n\n${content}`
submitting = true
let relays = [
...(repo_event.relays.length > 3
@ -98,7 +100,7 @@ @@ -98,7 +100,7 @@
<div class="flex">
<div class="flex-auto"></div>
<button
on:click={() => sendIssue(`${title}\n\n${content}`)}
on:click={() => sendIssue(title, content)}
disabled={submitting || title.length < 10}
class="align-right btn btn-primary btn-sm mt-2 align-bottom"
>

1
src/lib/wrappers/ComposeReply.svelte

@ -49,6 +49,7 @@ @@ -49,6 +49,7 @@
if (!$logged_in_user) return
let new_event = new NDKEvent(ndk)
new_event.kind = reply_kind
if (reply_kind !== 1) event.tags.push(['alt', `git reply`])
new_event.tags.push([
'e',
getRootId(event),

Loading…
Cancel
Save