diff --git a/src/views/repos/Release.svelte b/src/views/repos/Release.svelte
index c346492da..ee084c917 100644
--- a/src/views/repos/Release.svelte
+++ b/src/views/repos/Release.svelte
@@ -61,21 +61,33 @@
delegateIds.has(a.author.id),
);
// Artifacts are scoped to delegate authors by default; the endpoint returns
- // all of them, so filtering happens client-side.
- $: authorArtifacts = allAuthors ? release.artifacts : delegateArtifacts;
+ // all of them, so filtering happens client-side. With no delegate artifact
+ // at all, fall back to every author.
+ $: authorArtifacts =
+ allAuthors || delegateArtifacts.length === 0
+ ? release.artifacts
+ : delegateArtifacts;
$: shownArtifacts = visible(authorArtifacts, showRedacted, delegateIds);
+ // The redacted count is the hidden set within the current author scope.
+ $: redactedCount = authorArtifacts.filter(a =>
+ redactedByTrusted(a, delegateIds),
+ ).length;
- // Segment counts reflect what each choice would actually show; the redacted
- // count is the hidden set within the current author scope.
+ // Segment counts reflect what each choice would actually show, so an
+ // artifact hidden as redacted never counts towards a scope. They label the
+ // segments only: the author scope and the filter visibility come from the
+ // unfiltered sets, so toggling redacted artifacts never moves them.
$: delegateCount = visible(
delegateArtifacts,
showRedacted,
delegateIds,
).length;
$: allCount = visible(release.artifacts, showRedacted, delegateIds).length;
- $: redactedCount = authorArtifacts.filter(a =>
- redactedByTrusted(a, delegateIds),
- ).length;
+
+ // Filter only when both scopes hold something.
+ $: showFilters =
+ delegateArtifacts.length > 0 &&
+ delegateArtifacts.length !== release.artifacts.length;
// Format a byte count as a human-readable size (mirrors the CLI display).
function formatBytes(bytes: number): string {
@@ -171,6 +183,12 @@
padding: 1rem;
border-bottom: 1px solid var(--color-border-subtle);
}
+ .redacted-toggle {
+ margin-left: auto;
+ }
+ .filter-divider {
+ border-bottom: 1px solid var(--color-border-subtle);
+ }
.empty-artifacts {
display: flex;
flex-direction: column;
@@ -406,6 +424,9 @@
{baseUrl}
nodeId={release.creator.id}
alias={release.creator.alias} />
+ {#if delegateIds.has(release.creator.id)}
+
+ {/if}
released
@@ -415,59 +436,71 @@
diff --git a/src/views/repos/Release/ReleaseTeaser.svelte b/src/views/repos/Release/ReleaseTeaser.svelte
index 3c04c8c95..dff591d0e 100644
--- a/src/views/repos/Release/ReleaseTeaser.svelte
+++ b/src/views/repos/Release/ReleaseTeaser.svelte
@@ -3,6 +3,7 @@
import { absoluteTimestamp, formatTimestamp } from "@app/lib/utils";
+ import DelegateBadge from "./DelegateBadge.svelte";
import Icon from "@app/components/Icon.svelte";
import Id from "@app/components/Id.svelte";
import InlineTitle from "@app/views/repos/components/InlineTitle.svelte";
@@ -10,6 +11,7 @@
import NodeId from "@app/components/NodeId.svelte";
export let baseUrl: BaseUrl;
+ export let delegateIds: Set;
export let release: Release;
export let repoId: string;
export let allAuthors: boolean = false;
@@ -101,6 +103,9 @@
{baseUrl}
nodeId={release.creator.id}
alias={release.creator.alias} />
+ {#if delegateIds.has(release.creator.id)}
+
+ {/if}
released
diff --git a/src/views/repos/Releases.svelte b/src/views/repos/Releases.svelte
index 2cbee2b47..201bacf16 100644
--- a/src/views/repos/Releases.svelte
+++ b/src/views/repos/Releases.svelte
@@ -21,6 +21,7 @@
export let repo: Repo;
export let repoId: string;
export let allAuthors: boolean;
+ export let showFilters: boolean;
export let nodeId: string;
export let nodeAvatarUrl: string | undefined;
@@ -36,13 +37,15 @@
}
$: delegateIds = new Set(repo.delegates.map(d => d.id));
- // The delegate count isn't in repo metadata; derive it from the loaded list.
- // In the all-authors view we filter for delegates; otherwise the loaded list
- // already is the delegate set.
+ // The delegate count isn't in repo metadata; derive it from the loaded
+ // pages. It labels the segment only, and reads as "30+" while pages are
+ // outstanding; whether the segments show at all is settled by the router.
$: delegateReleaseCount = allAuthors
? allReleases.filter(r => delegateIds.has(r.creator.id)).length
: allReleases.length;
+ $: releaseCount = repo.payloads["xyz.radicle.project"].meta.releases;
+
const api = new HttpdClient(baseUrl);
async function loadReleases(): Promise {
@@ -133,46 +136,49 @@
Releases
-
{/if}
diff --git a/src/views/repos/router.ts b/src/views/repos/router.ts
index d26cf334b..ece5a98db 100644
--- a/src/views/repos/router.ts
+++ b/src/views/repos/router.ts
@@ -283,6 +283,7 @@ export type RepoLoadedRoute =
repoId: string;
releases: Release[];
allAuthors: boolean;
+ showFilters: boolean;
nodeId: string;
nodeAvatarUrl: string | undefined;
};
@@ -509,8 +510,10 @@ async function loadReleasesView(
// Fetch releases alongside the repo so the common path stays parallel; the
// repo's `meta.releases` then tells us whether a failure is an unsupported
- // node or a genuine error.
- const [repo, releasesResult, node] = await Promise.all([
+ // node or a genuine error. The delegate scope is a subset of every author,
+ // so the all-authors view sizes both scopes from its own page, while the
+ // delegate view has to ask for the other scope to size it.
+ const [repo, releasesResult, everyAuthorPage, node] = await Promise.all([
api.repo.getByRid(route.repo),
api.repo
.getAllReleases(route.repo, {
@@ -522,23 +525,59 @@ async function loadReleasesView(
releases => ({ releases }),
(error: unknown) => ({ error }),
),
+ allAuthors
+ ? undefined
+ : api.repo
+ .getAllReleases(route.repo, {
+ allAuthors: true,
+ page: 0,
+ perPage: RELEASES_PER_PAGE,
+ })
+ // Only the filter rides on this, so a failure here shouldn't take
+ // the page down with it.
+ .catch(() => undefined),
api.getNode(),
]);
- if (repo.payloads["xyz.radicle.project"].meta.releases === undefined) {
+ const releaseCount = repo.payloads["xyz.radicle.project"].meta.releases;
+ if (releaseCount === undefined) {
return releasesNotSupported(route.node);
}
if ("error" in releasesResult) {
throw releasesResult.error;
}
+ const releases = releasesResult.releases;
+
+ // Offer the author filter only where the two scopes hold different releases,
+ // so a repo whose releases are all by delegates carries no filter with an
+ // identical list behind it, and one with none of its own still leaves a way
+ // through to the others. Both sizes come from a list the endpoint returned:
+ // `meta.releases` counts every release COB, including ones the endpoint
+ // hides such as fully redacted releases, so it would overcount either scope.
+ // A full page means the list may go on, so keep the filter rather than have
+ // it appear or vanish as the user pages, and keep it too if the other scope
+ // failed to load. Decided here so it stays fixed for the life of the route.
+ const delegateIds = new Set(repo.delegates.map(d => d.id));
+ const delegateReleaseCount = allAuthors
+ ? releases.filter(r => delegateIds.has(r.creator.id)).length
+ : releases.length;
+ const everyAuthorCount = allAuthors
+ ? releases.length
+ : everyAuthorPage?.length;
+ const showFilters =
+ everyAuthorCount === undefined ||
+ everyAuthorCount === RELEASES_PER_PAGE ||
+ delegateReleaseCount !== everyAuthorCount;
+
return {
resource: "repo.releases",
params: {
baseUrl: route.node,
repoId: route.repo,
- releases: releasesResult.releases,
+ releases,
allAuthors,
+ showFilters,
repo,
nodeId: node.id,
nodeAvatarUrl: node.avatarUrl,
diff --git a/tests/e2e/repo/releases.spec.ts b/tests/e2e/repo/releases.spec.ts
index a624a8ac5..edbd6dd6d 100644
--- a/tests/e2e/repo/releases.spec.ts
+++ b/tests/e2e/repo/releases.spec.ts
@@ -76,7 +76,7 @@ test.describe(() => {
const { rid } = await createRepo(peer, { name: "no-releases" });
await page.goto(`${peer.uiUrl()}/${rid}/releases`);
- await expect(page.getByText("No releases")).toBeVisible();
+ await expect(page.getByText("No releases", { exact: true })).toBeVisible();
});
test("hide fully redacted releases", async ({ page, peer }) => {
@@ -97,7 +97,7 @@ test.describe(() => {
]);
await page.goto(`${peer.uiUrl()}/${rid}/releases`);
- await expect(page.getByText("No releases")).toBeVisible();
+ await expect(page.getByText("No releases", { exact: true })).toBeVisible();
// The tab counter comes from the repo metadata, which counts every release
// COB, redacted or not.