From b704c1f8b56ffdac97cf87caa7d6ff005cfe2d71 Mon Sep 17 00:00:00 2001 From: Seongmin Lee Date: Tue, 3 Nov 2026 15:08:48 +0900 Subject: [PATCH] web: always show both commit-id and change-id we can't hide either one. both are valuable Signed-off-by: Seongmin Lee --- .../lib/components/repo/CompareView.svelte | 4 +- .../repo/pulls/PullCommitList.stories.svelte | 6 --- .../repo/pulls/PullCommitList.svelte | 17 +------ .../pulls/PullCommitListHeader.stories.svelte | 29 ----------- .../repo/pulls/PullCommitListHeader.svelte | 35 ++----------- .../repo/pulls/PullCommitRow.svelte | 51 ++++++------------- .../components/repo/pulls/PullCompose.svelte | 4 +- .../[version]/[[range]]/PullViewPage.svelte | 3 -- 8 files changed, 21 insertions(+), 128 deletions(-) diff --git a/web/src/lib/components/repo/CompareView.svelte b/web/src/lib/components/repo/CompareView.svelte index 3758bf7ad..ed82eae7f 100644 --- a/web/src/lib/components/repo/CompareView.svelte +++ b/web/src/lib/components/repo/CompareView.svelte @@ -37,7 +37,6 @@ const repoPath = $derived(`/${repo.ownerHandle}/${repo.name}`); const commits = $derived(compare.commits); const hasChanges = $derived(!compare.error && commits.length > 0); - let showChangeIds = $state(true); const navigate = (base: string, head: string) => void goto(resolve(comparePath(repoPath, base, head) as "/"), { reset: false }); @@ -192,12 +191,11 @@ )} {:else} - + - - {#snippet template(args)} - {@render frame(args)} - {/snippet} - - ; selection: PullCommitSelection; - showChangeIds?: boolean; } - let { - ownerHandle, - repoName, - commits, - pipelineStatuses, - selection, - showChangeIds = $bindable(true) - }: Props = $props(); - - const hasChangeIds = $derived(commits.some((commit) => commit.changeId !== undefined)); - const toggleIds = $derived(hasChangeIds ? () => (showChangeIds = !showChangeIds) : undefined); + let { ownerHandle, repoName, commits, pipelineStatuses, selection }: Props = $props(); // where row `i` sits inside a range, so the row can style its own ends function band(i: number, { start, end }: Range): Band { @@ -86,8 +75,6 @@ {commit} {pipelineStatuses} showAvatar={showAvatars} - showChangeId={showChangeIds} - ontoggleIds={toggleIds} {...actions} /> {/snippet} @@ -133,8 +120,6 @@ {commit} {pipelineStatuses} showAvatar={showAvatars} - showChangeId={showChangeIds} - ontoggleIds={toggleIds} onclick={focus} /> diff --git a/web/src/lib/components/repo/pulls/PullCommitListHeader.stories.svelte b/web/src/lib/components/repo/pulls/PullCommitListHeader.stories.svelte index 8445d9814..ee63fb9eb 100644 --- a/web/src/lib/components/repo/pulls/PullCommitListHeader.stories.svelte +++ b/web/src/lib/components/repo/pulls/PullCommitListHeader.stories.svelte @@ -2,7 +2,6 @@ import { defineMeta } from "@storybook/addon-svelte-csf"; import type { ComponentProps } from "svelte"; import PullCommitListHeader from "#lib/components/repo/pulls/PullCommitListHeader.svelte"; - import PullCommitList from "#lib/components/repo/pulls/PullCommitList.svelte"; import IterationCcw from "$icon/iteration-ccw"; import Button from "#lib/components/ui/Button.svelte"; import Card from "#lib/components/ui/Card.svelte"; @@ -72,7 +71,6 @@ // `oncommitVersions` asks, same as the real page's confirmVersions let viewed = $state({ start: 1, end: 1 }); let commits_ = $state(0); - let showChangeIds = $state(true); {#snippet frame(args: Props)} @@ -109,33 +107,6 @@ {/snippet} - - - {#snippet template(args)} - {@render frame(args)} - {/snippet} - - - - {#snippet template(args)} - - - {} }} - bind:showChangeIds - /> - - {/snippet} - - {#snippet template(args)} diff --git a/web/src/lib/components/repo/pulls/PullCommitListHeader.svelte b/web/src/lib/components/repo/pulls/PullCommitListHeader.svelte index 660ead52b..21eea365a 100644 --- a/web/src/lib/components/repo/pulls/PullCommitListHeader.svelte +++ b/web/src/lib/components/repo/pulls/PullCommitListHeader.svelte @@ -6,52 +6,23 @@ import PullVersionList from "#lib/components/repo/pulls/PullVersionList.svelte"; import { type Range } from "#lib/components/ui/RangeSelector.svelte"; import type { PullSubmission } from "#lib/api/index.ts"; - import TextSwap from "#lib/components/ui/TextSwap.svelte"; interface Props { commits: CommitSummary[]; versions?: PullSubmission[]; versionRange?: Range; oncommitVersions?: (range: Range) => void; - showChangeIds?: boolean; actions?: Snippet; } - let { - versions, - commits, - versionRange, - oncommitVersions, - showChangeIds = $bindable(true), - actions - }: Props = $props(); - - const hasChangeIds = $derived(commits.some((commit) => commit.changeId !== undefined)); - - // several commits can carry one change id, so the two counts differ - const count = $derived( - showChangeIds - ? new Set(commits.map((commit) => commit.changeId ?? commit.hash)).size - : commits.length - ); + let { versions, commits, versionRange, oncommitVersions, actions }: Props = $props();
- {#if hasChangeIds} - - {:else} - Commits - {/if} - {count} + Commits + {commits.length}
{@render actions?.()} diff --git a/web/src/lib/components/repo/pulls/PullCommitRow.svelte b/web/src/lib/components/repo/pulls/PullCommitRow.svelte index e385e1e78..cf7b9421b 100644 --- a/web/src/lib/components/repo/pulls/PullCommitRow.svelte +++ b/web/src/lib/components/repo/pulls/PullCommitRow.svelte @@ -7,7 +7,6 @@ import type { CommitStatuses } from "#lib/api/commitStatuses.ts"; import ProfilePopover from "#lib/components/profile/ProfilePopover.svelte"; import Avatar from "#lib/components/ui/Avatar.svelte"; - import TextSwap from "#lib/components/ui/TextSwap.svelte"; import PipelineWorkflows from "#lib/components/repo/pipelines/PipelineWorkflows.svelte"; import type { CommitSummary } from "#lib/components/repo/types.ts"; @@ -17,8 +16,6 @@ commit: CommitSummary; pipelineStatuses?: Promise; showAvatar?: boolean; - showChangeId?: boolean; - ontoggleIds?: () => void; onclick?: (event: MouseEvent) => void; onpointerenter?: () => void; onpointerleave?: () => void; @@ -30,8 +27,6 @@ commit, pipelineStatuses, showAvatar = true, - showChangeId = true, - ontoggleIds, onclick, onpointerenter, onpointerleave @@ -39,12 +34,6 @@ let expanded = $state(false); - // selecting the id to copy it ends in a click, which must not flip every row - const flipIds = () => { - if (window.getSelection()?.toString()) return; - ontoggleIds?.(); - }; - // the browser only offers Copy when the click lands inside a selection, so take the id // for the reader and let the native menu open over it const selectId = (event: MouseEvent) => { @@ -59,14 +48,13 @@ const signOffs = $derived(signOffsFrom(commit.body)); const hasBody = $derived(hasBodyBeyondSignOffs(commit.body)); const changeId = $derived(commit.changeId?.slice(0, 8)); - const id = $derived(showChangeId && changeId ? changeId : commit.shortHash);
{#if onclick} {/if} - {#if ontoggleIds} - - - {:else} +
diff --git a/web/src/lib/components/repo/pulls/PullCompose.svelte b/web/src/lib/components/repo/pulls/PullCompose.svelte index 56a99ffb4..070e60720 100644 --- a/web/src/lib/components/repo/pulls/PullCompose.svelte +++ b/web/src/lib/components/repo/pulls/PullCompose.svelte @@ -57,7 +57,6 @@ const accounts = $derived(auth?.accounts ?? []); let picked = $state(null); - let showChangeIds = $state(true); const acting = $derived( accounts.find((account) => account.did === (picked ?? auth?.currentDid)) ); @@ -410,12 +409,11 @@ : "No commits between target and source. Make sure your source branch has commits not on the target." )} {:else} - + @@ -1118,7 +1116,6 @@ repoName={data.repo.name} {commits} {pipelineStatuses} - bind:showChangeIds selection={isInterdiff ? { mode: "change", -- knotmirror 0.0.1