{#if view === "description"} {@const body = revision.description.slice(-1)[0].body} {@const canEdit = roles.isDelegateOrAuthor( config.publicKey, repoDelegates.map(d => d.did), revision.author.did, )} {#if editingDescription}
{ await editRevision(comment, Array.from(embeds.values())); editingDescription = false; }} close={() => (editingDescription = false)} />
{:else}
{#if body.trim() !== ""} {:else} No description {/if}
{ try { await reactOnRevision(authors, emoji); } finally { closeFocused(); } }} />
{#if canEdit} {/if}
{/if} {#if revision.reactions && revision.reactions.length > 0}
{/if} {:else if view === "activity"} {#snippet renderActivity(data: ActivityData, opts: { hideAuthor: boolean })} {#if data.kind === "op"} {#if data.op.type === "revision"} {@const revId = data.op.id} {@const isFirst = revId === firstRevisionId} {@const isOlder = olderRevisionIds.has(revId)} {@const hasCommits = !!data.commits && data.commits.length > 0} {@const revBody = isFirst ? undefined : splitDescription(data.op.description).body} {@const hasBody = !!revBody} {@const toggleable = hasCommits || hasBody} {@const expanded = toggleable && isRevisionExpanded(revId)} {@const targetRev = revisions.find(r => r.id === revId)} {@const descriptionVisible = hasBody && !isCommitListDescription(data.op.description, data.commits)} {@const canEditRevision = !isFirst && !!targetRev && roles.isDelegateOrAuthor( config.publicKey, repoDelegates.map(d => d.did), targetRev.author.did, )} {@const descriptionSubject = splitDescription( data.op.description, ).subject} {@const descriptionEditorPrefill = isCommitListDescription( data.op.description, data.commits, ) ? "" : (revBody ?? "")} {#if expanded}
1 && revId === latestRevisionId} reviewInProgress={draftRevisionIds.includes(revId)} onOpenReview={() => onViewChanges?.(revId)} onOpenChanges={onViewChanges ? () => onViewChanges?.(revId) : undefined} {expanded} hideAuthor={opts.hideAuthor} bodyExternal onToggle={toggleable ? () => toggleRevision(revId) : undefined} />
{#if isEditingRevisionDescription(revId)}
{ // Keep the revision's subject (its first line, shown as // the title); only replace the body beneath it. const body = comment.trim(); const next = descriptionSubject ? body ? `${descriptionSubject}\n\n${body}` : descriptionSubject : body; await editRevision( next, Array.from(embeds.values()), revId, ); setEditingRevisionDescription(revId, false); }} close={() => setEditingRevisionDescription(revId, false)} />
{:else if descriptionVisible}
{#if canEditRevision}
{/if}
{:else if canEditRevision}
{/if} {#if (descriptionVisible || canEditRevision) && hasCommits && !isEditingRevisionDescription(revId)}
{/if} {#if hasCommits && data.commits && data.commits.length > 0}
{#each groupCommitsByAuthor(data.commits) as group (group[0].id)} {#if group.length > 1} {@const groupKey = group[0].id} {@const groupExpanded = isCommitGroupExpanded(groupKey)} {@const collapsed = !groupExpanded && group.length > COMMIT_COLLAPSE_THRESHOLD} {@const visibleCommits = collapsed ? group.slice(0, MAX_COMMITS_VISIBLE) : group} {@const hiddenCount = collapsed ? group.length - MAX_COMMITS_VISIBLE : 0}
{group[0].author.name} <{group[0].author.email}> added {group.length} commits
{#each visibleCommits as commit (commit.id)} {/each} {#if collapsed}
expandCommitGroup(groupKey)}>
Show {hiddenCount} more {hiddenCount === 1 ? "commit" : "commits"}
{/if}
{:else} {/if} {/each}
{/if} {#if targetRev && targetRev.base !== targetRev.head} {#if hasBody || hasCommits}
{/if}
{#await cachedGetDiff( rid, { base: targetRev.base, head: targetRev.head } )}
Loading diff…
{:then diff} {@const previewFiles = diff.files .filter(f => !isIgnoredFile(f)) .slice(0, 5)}
{diff.stats.filesChanged} {pluralize("file", diff.stats.filesChanged)} modified with {diff.stats.insertions} {pluralize("insertion", diff.stats.insertions)} and {diff.stats.deletions} {pluralize("deletion", diff.stats.deletions)}
{#each previewFiles as file, i (i)} {@const path = fileDiffPath(file)}
{#snippet leftHeader()} {@const statusLabel = fileStatusLabel( file.status, )} {#if statusLabel} {statusLabel} {/if} {/snippet} {#snippet rightHeader()} {#if file.diff.type === "plain"} +{file.diff.stats.additions} -{file.diff.stats.deletions} {/if} {/snippet} {#await cachedGetDiffText(rid, targetRev.base, targetRev.head, 3, path)}
{:then filePatch} {/await}
{/each}
{:catch error}
Failed to load diff: {error?.message ?? error}
{/await}
{/if}
{:else if isOlder}
toggleRevision(revId) : undefined} onOpenChanges={onViewChanges ? () => onViewChanges?.(revId) : undefined} />
{:else} toggleRevision(revId) : undefined} onOpenChanges={onViewChanges ? () => onViewChanges?.(revId) : undefined} /> {/if} {:else if data.op.type === "review"} {@const opId = data.op.id} {@const threads = data.reviewThreads ?? []} {@const hasThreads = threads.length > 0} {@const discussion = data.reviewComments ?? []} {@const reviewRecord = (revision.reviews ?? []).find( r => r.id === opId, )} {@const hasReviewComments = (reviewRecord?.comments?.length ?? 0) > 0} void push({ resource: "repo.patch", rid, patch: patchId, status: undefined, reviewId: opId, }) : undefined} /> {#if discussion.length > 0}
{#each discussion as thread (thread.root.id)} delegate.did), )} editComment={codeActions.editComment} deleteComment={codeActions.deleteComment} reactOnComment={codeActions.reactOnComment} createReply={createCodeComment} /> {/each}
{/if} {#if hasThreads}
{#each groupThreadsByFile(threads) as group (group.path)} {/each}
{/if} {:else} {/if} {:else if data.kind === "opened"} {:else if data.kind === "olderRevisions"}
toggleRevisionRun(data.groupKey, data.revisionIds)}>
{#if !opts.hideAuthor && data.author} {/if} {#if data.expanded} collapse {data.count} {data.count === 1 ? "revision" : "revisions"} {:else} created {data.count} {data.count === 1 ? "revision" : "revisions"} {/if}
{/if} {/snippet} data.kind === "op" || data.kind === "opened" ? data.op.author : data.author} /> {:else} {@const canEditChanges = roles.isDelegateOrAuthor( config.publicKey, repoDelegates.map(d => d.did), revision.author.did, )} { await editRevision(body, embeds, revision.id); }} {chrome} {tabs} bind:showingRevisionDiff bind:filesExpanded bind:commentPosition /> {/if}