Skip to content

Commit c7accf4

Browse files
committed
fix build
1 parent 17d98d6 commit c7accf4

File tree

4 files changed

+34
-12
lines changed

4 files changed

+34
-12
lines changed

components/dashboard/src/data/workspaces/list-workspaces-query.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* See License.AGPL.txt in the project root for license information.
55
*/
66

7-
import { WorkspaceInfo } from "@gitpod/gitpod-protocol";
7+
import { GetWorkspacesScope, WorkspaceInfo } from "@gitpod/gitpod-protocol";
88
import { useQuery } from "@tanstack/react-query";
99
import { getGitpodService } from "../../service/service";
1010
import { useCurrentOrg } from "../organizations/orgs-query";
@@ -26,6 +26,7 @@ export const useListWorkspacesQuery = ({ limit }: UseListWorkspacesQueryArgs) =>
2626
limit,
2727
includeWithoutProject: true,
2828
organizationId: currentOrg.data?.id,
29+
scope: GetWorkspacesScope.MY_WORKSPACES_IN_ORGANIZATION,
2930
}),
3031
// Additional fetch for pinned workspaces
3132
// see also: https://github.com/gitpod-io/gitpod/issues/4488
@@ -34,12 +35,13 @@ export const useListWorkspacesQuery = ({ limit }: UseListWorkspacesQueryArgs) =>
3435
pinnedOnly: true,
3536
includeWithoutProject: true,
3637
organizationId: currentOrg.data?.id,
38+
scope: GetWorkspacesScope.MY_WORKSPACES_IN_ORGANIZATION,
3739
}),
3840
]);
3941

4042
// Merge both data sets into one unique (by ws id) array
41-
const workspacesMap = new Map(infos.map((ws) => [ws.workspace.id, ws]));
42-
const pinnedWorkspacesMap = new Map(pinned.map((ws) => [ws.workspace.id, ws]));
43+
const workspacesMap = new Map(infos.rows.map((ws) => [ws.workspace.id, ws]));
44+
const pinnedWorkspacesMap = new Map(pinned.rows.map((ws) => [ws.workspace.id, ws]));
4345
const workspaces = Array.from(new Map([...workspacesMap, ...pinnedWorkspacesMap]).values());
4446

4547
return workspaces;

components/server/src/authorization/relationship-updater.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,8 @@ export class RelationshipUpdater {
147147
includeHeadless: false,
148148
includeWithoutProject: true,
149149
limit: 500, // The largest amount of workspaces is 189 today (2023-08-24)
150+
151+
buildBuild: true,
150152
});
151153

152154
for (const ws of workspaces.rows) {

components/server/src/workspace/gitpod-server-impl.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ import {
7272
GetDefaultWorkspaceImageResult,
7373
SearchRepositoriesParams,
7474
PaginationResponse,
75+
GetWorkspacesScope,
7576
} from "@gitpod/gitpod-protocol";
7677
import { BlockedRepository } from "@gitpod/gitpod-protocol/lib/blocked-repositories-protocol";
7778
import {
@@ -1516,9 +1517,10 @@ export class GitpodServerImpl implements GitpodServerWithTracing, Disposable {
15161517
promises.push(
15171518
this.getWorkspaces(ctx, {
15181519
/* limit: 20 */
1520+
scope: GetWorkspacesScope.MY_WORKSPACES_IN_ORGANIZATION,
15191521
})
15201522
.then((workspaces) => {
1521-
workspaces.forEach((ws) => {
1523+
workspaces.rows.forEach((ws) => {
15221524
let repoUrl;
15231525
if (CommitContext.is(ws.workspace.context)) {
15241526
repoUrl = ws.workspace.context?.repository?.cloneUrl?.replace(/\.git$/, "");
@@ -1635,10 +1637,13 @@ export class GitpodServerImpl implements GitpodServerWithTracing, Disposable {
16351637
const fetchRecentRepos = async (): Promise<SuggestedRepositoryWithSorting[]> => {
16361638
const span = TraceContext.startSpan("getSuggestedRepositories.fetchRecentRepos", ctx);
16371639

1638-
const workspaces = await this.getWorkspaces(ctx, { organizationId });
1640+
const workspaces = await this.getWorkspaces(ctx, {
1641+
organizationId,
1642+
scope: GetWorkspacesScope.MY_WORKSPACES_IN_ORGANIZATION,
1643+
});
16391644
const recentRepos: SuggestedRepositoryWithSorting[] = [];
16401645

1641-
for (const ws of workspaces) {
1646+
for (const ws of workspaces.rows) {
16421647
let repoUrl;
16431648
let repoName;
16441649
if (CommitContext.is(ws.workspace.context)) {

components/server/src/workspace/workspace-service.spec.db.ts

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { TypeORM } from "@gitpod/gitpod-db/lib";
88
import { resetDB } from "@gitpod/gitpod-db/lib/test/reset-db";
99
import {
1010
CommitContext,
11+
GetWorkspacesScope,
1112
Organization,
1213
Project,
1314
User,
@@ -210,13 +211,19 @@ describe("WorkspaceService", async () => {
210211
const svc = container.get(WorkspaceService);
211212
await createTestWorkspace(svc, org, owner, project);
212213

213-
const ownerResult = await svc.getWorkspaces(owner.id, {});
214+
const ownerResult = await svc.getWorkspaces(owner.id, {
215+
scope: GetWorkspacesScope.MY_WORKSPACES_IN_ORGANIZATION,
216+
});
214217
expect(ownerResult.total).to.equal(1);
215218

216-
const memberResult = await svc.getWorkspaces(member.id, {});
219+
const memberResult = await svc.getWorkspaces(member.id, {
220+
scope: GetWorkspacesScope.MY_WORKSPACES_IN_ORGANIZATION,
221+
});
217222
expect(memberResult.total).to.equal(0);
218223

219-
const strangerResult = await svc.getWorkspaces(stranger.id, {});
224+
const strangerResult = await svc.getWorkspaces(stranger.id, {
225+
scope: GetWorkspacesScope.MY_WORKSPACES_IN_ORGANIZATION,
226+
});
220227
expect(strangerResult.total).to.equal(0);
221228
});
222229

@@ -226,14 +233,20 @@ describe("WorkspaceService", async () => {
226233

227234
await svc.controlAdmission(owner.id, ws.id, "everyone");
228235

229-
const ownerResult = await svc.getWorkspaces(owner.id, {});
236+
const ownerResult = await svc.getWorkspaces(owner.id, {
237+
scope: GetWorkspacesScope.MY_WORKSPACES_IN_ORGANIZATION,
238+
});
230239
expect(ownerResult.total, "owner").to.equal(1);
231240

232241
// getWorkspaces is limited to the user's own workspaces atm
233-
const memberResult = await svc.getWorkspaces(member.id, {});
242+
const memberResult = await svc.getWorkspaces(member.id, {
243+
scope: GetWorkspacesScope.MY_WORKSPACES_IN_ORGANIZATION,
244+
});
234245
expect(memberResult.total, "member").to.equal(0);
235246

236-
const strangerResult = await svc.getWorkspaces(stranger.id, {});
247+
const strangerResult = await svc.getWorkspaces(stranger.id, {
248+
scope: GetWorkspacesScope.MY_WORKSPACES_IN_ORGANIZATION,
249+
});
237250
expect(strangerResult.total, "stranger").to.equal(0);
238251
});
239252

0 commit comments

Comments
 (0)