Skip to content

Commit c96553e

Browse files
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 <[email protected]> Co-authored-by: crgallego <[email protected]>
1 parent 6918dd3 commit c96553e

2 files changed

Lines changed: 21 additions & 8 deletions

File tree

‎desktop/src/features/projects/lib/projectHomeChannel.test.mjs‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,3 +139,19 @@ test("findProjectHomeByChannelId prefers the oldest listed authoritative home",
139139
]);
140140
assert.equal(selected?.id, "original");
141141
});
142+
143+
test("findProjectHomeByChannelId falls back to an unlisted authoritative home", () => {
144+
const selected = findProjectHomeByChannelId("channel-a", [
145+
{
146+
createdAt: 50,
147+
id: "unlisted-home",
148+
legacy: false,
149+
owner: OWNER,
150+
projectChannelId: "channel-a",
151+
repositories: [{ channelId: "channel-a", owner: OWNER }],
152+
visibility: "unlisted",
153+
},
154+
]);
155+
156+
assert.equal(selected?.id, "unlisted-home");
157+
});

‎desktop/src/features/projects/useProjectChannelRequests.ts‎

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { subscribeProjectChannelRequests } from "@/features/agents/observerRelay
66
import { useManagedAgentsQuery } from "@/features/agents/hooks";
77
import { useChannelsQuery } from "@/features/channels/hooks";
88
import { useChannelTemplatesQuery } from "@/features/channel-templates/hooks";
9+
import { findProjectHomeByChannelId } from "@/features/projects/lib/projectHomeSelection";
910
import { useProjectsQuery } from "@/features/projects/hooks";
1011
import type { ProjectChannelRequest } from "@/features/projects/projectChannelRequest";
1112
import {
@@ -103,14 +104,10 @@ export function useProjectChannelRequests() {
103104
const project =
104105
request == null
105106
? null
106-
: ([...(projectsQuery.data ?? [])]
107-
.filter(
108-
(candidate) =>
109-
!candidate.legacy &&
110-
candidate.visibility !== "unlisted" &&
111-
candidate.projectChannelId === request.request.homeChannelId,
112-
)
113-
.sort((left, right) => left.createdAt - right.createdAt)[0] ?? null);
107+
: findProjectHomeByChannelId(
108+
request.request.homeChannelId,
109+
projectsQuery.data ?? [],
110+
);
114111
const template =
115112
request?.request.templateName == null
116113
? null

0 commit comments

Comments
 (0)