{#snippet commentActions(comment: CommentView, noun: "comment" | "reply")}
{#if auth?.hasAccount(comment.authorDid) || reporting.canReport(comment.authorDid)} {#if auth?.hasAccount(comment.authorDid)} (editingUri = comment.uri)}> Edit {noun} handleDelete(comment, noun)} > Delete {noun} {/if} {/if}
{/snippet} {#snippet commentEditor( comment: CommentView, replyUri: string | undefined, replyCid: string | undefined )} { editingUri = null; onedited?.(edited); }} oncancel={() => (editingUri = null)} /> {/snippet} {#snippet selfEditor()} {@render commentEditor(thread.self, undefined, undefined)} {/snippet} {#snippet selfActions()} {@render commentActions(thread.self, "comment")} {/snippet}
setReactions(thread.self.uri, next)} editor={editingUri === thread.self.uri ? selfEditor : undefined} actions={currentUser && editingUri !== thread.self.uri && !thread.self.deleted ? selfActions : undefined} />
{#if thread.replies.length}
{#each thread.replies as reply, i (reply.uri)} {#snippet replyEditor()} {@render commentEditor(reply, thread.self.uri, thread.self.cid)} {/snippet} {#snippet replyActions()} {@render commentActions(reply, "reply")} {/snippet}
setReactions(reply.uri, next)} editor={editingUri === reply.uri ? replyEditor : undefined} actions={currentUser && editingUri !== reply.uri ? replyActions : undefined} />
{/each}
{/if} {#if deleteSelected.error}
{/if} {#if thread.self.deleted && !thread.self.cid} {:else if replying && currentUser}
{ replying = false; onsubmitted?.(submitted); }} oncancel={() => (replying = false)} />
{:else}
{#if currentUser} {:else} Login to leave a reply {/if}
{/if}