mirror of
https://github.com/block/buzz.git
synced 2026-10-27 04:30:52 +00:00
fix(desktop): resolve unlisted project channel requests (#7619)
## Summary - resolve project channel-creation approvals through the authoritative home-channel selector - permit owner-visible unlisted project homes when their channel and repository binding match - add regression coverage for the unlisted authoritative-home path ## Validation - `just ci` - focused project-home regression tests (10/10) - full Desktop suite (6,451/6,451) - `pnpm check` - `pnpm build` ## Manual verification After merging into a Desktop build, approve the pending LBX Copywriting workroom request from the Litbox OS project. Signed-off-by: crgallego <chris.cokerconstruction@gmail.com> Co-authored-by: crgallego <chris.cokerconstruction@gmail.com>
This commit is contained in:
@@ -139,3 +139,19 @@ test("findProjectHomeByChannelId prefers the oldest listed authoritative home",
|
||||
]);
|
||||
assert.equal(selected?.id, "original");
|
||||
});
|
||||
|
||||
test("findProjectHomeByChannelId falls back to an unlisted authoritative home", () => {
|
||||
const selected = findProjectHomeByChannelId("channel-a", [
|
||||
{
|
||||
createdAt: 50,
|
||||
id: "unlisted-home",
|
||||
legacy: false,
|
||||
owner: OWNER,
|
||||
projectChannelId: "channel-a",
|
||||
repositories: [{ channelId: "channel-a", owner: OWNER }],
|
||||
visibility: "unlisted",
|
||||
},
|
||||
]);
|
||||
|
||||
assert.equal(selected?.id, "unlisted-home");
|
||||
});
|
||||
|
||||
@@ -6,6 +6,7 @@ import { subscribeProjectChannelRequests } from "@/features/agents/observerRelay
|
||||
import { useManagedAgentsQuery } from "@/features/agents/hooks";
|
||||
import { useChannelsQuery } from "@/features/channels/hooks";
|
||||
import { useChannelTemplatesQuery } from "@/features/channel-templates/hooks";
|
||||
import { findProjectHomeByChannelId } from "@/features/projects/lib/projectHomeSelection";
|
||||
import { useProjectsQuery } from "@/features/projects/hooks";
|
||||
import type { ProjectChannelRequest } from "@/features/projects/projectChannelRequest";
|
||||
import {
|
||||
@@ -103,14 +104,10 @@ export function useProjectChannelRequests() {
|
||||
const project =
|
||||
request == null
|
||||
? null
|
||||
: ([...(projectsQuery.data ?? [])]
|
||||
.filter(
|
||||
(candidate) =>
|
||||
!candidate.legacy &&
|
||||
candidate.visibility !== "unlisted" &&
|
||||
candidate.projectChannelId === request.request.homeChannelId,
|
||||
)
|
||||
.sort((left, right) => left.createdAt - right.createdAt)[0] ?? null);
|
||||
: findProjectHomeByChannelId(
|
||||
request.request.homeChannelId,
|
||||
projectsQuery.data ?? [],
|
||||
);
|
||||
const template =
|
||||
request?.request.templateName == null
|
||||
? null
|
||||
|
||||
Reference in New Issue
Block a user