Skip to content

Commit c201696

Browse files
committed
Review fixes
1 parent 3624764 commit c201696

File tree

3 files changed

+11
-21
lines changed

3 files changed

+11
-21
lines changed

components/server/src/api/organization-service-api.ts

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,7 @@ export class OrganizationServiceAPI implements ServiceImpl<typeof OrganizationSe
7676
return response;
7777
}
7878

79-
async updateOrganization(
80-
req: UpdateOrganizationRequest,
81-
_: HandlerContext,
82-
): Promise<UpdateOrganizationResponse> {
79+
async updateOrganization(req: UpdateOrganizationRequest, _: HandlerContext): Promise<UpdateOrganizationResponse> {
8380
if (!uuidValidate(req.organizationId)) {
8481
throw new ConnectError("organizationId is required", Code.InvalidArgument);
8582
}
@@ -95,10 +92,7 @@ export class OrganizationServiceAPI implements ServiceImpl<typeof OrganizationSe
9592
});
9693
}
9794

98-
async listOrganizations(
99-
req: ListOrganizationsRequest,
100-
_: HandlerContext,
101-
): Promise<ListOrganizationsResponse> {
95+
async listOrganizations(req: ListOrganizationsRequest, _: HandlerContext): Promise<ListOrganizationsResponse> {
10296
const orgs = await this.orgService.listOrganizations(
10397
ctxUserId(),
10498
{
@@ -114,10 +108,7 @@ export class OrganizationServiceAPI implements ServiceImpl<typeof OrganizationSe
114108
return response;
115109
}
116110

117-
async deleteOrganization(
118-
req: DeleteOrganizationRequest,
119-
_: HandlerContext,
120-
): Promise<DeleteOrganizationResponse> {
111+
async deleteOrganization(req: DeleteOrganizationRequest, _: HandlerContext): Promise<DeleteOrganizationResponse> {
121112
if (!uuidValidate(req.organizationId)) {
122113
throw new ConnectError("organizationId is required", Code.InvalidArgument);
123114
}
@@ -259,10 +250,7 @@ export class OrganizationServiceAPI implements ServiceImpl<typeof OrganizationSe
259250
throw new ConnectError("nothing to update", Code.InvalidArgument);
260251
}
261252

262-
const settings = await this.orgService.updateSettings(ctxUserId(), req.organizationId, {
263-
workspaceSharingDisabled: req.workspaceSharingDisabled,
264-
defaultWorkspaceImage: req.defaultWorkspaceImage,
265-
});
253+
const settings = await this.orgService.updateSettings(ctxUserId(), req.organizationId, update);
266254
return new UpdateOrganizationSettingsResponse({
267255
settings: this.apiConverter.toOrganizationSettings(settings),
268256
});

components/server/src/prebuilds/github-app.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ export class GithubApp {
125125
},
126126
() => next(),
127127
);
128-
next();
129128
});
130129

131130
app.on("installation.created", (ctx: Context<"installation.created">) => {

components/server/src/websocket/websocket-connection-manager.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import {
2222
import { log } from "@gitpod/gitpod-protocol/lib/util/logging";
2323
import { EventEmitter } from "events";
2424
import express from "express";
25-
import { ErrorCodes as RPCErrorCodes, MessageConnection, ResponseError } from "vscode-jsonrpc";
25+
import { ErrorCodes as RPCErrorCodes, MessageConnection, ResponseError, CancellationToken } from "vscode-jsonrpc";
2626
import { AllAccessFunctionGuard, FunctionAccessGuard, WithFunctionAccessGuard } from "../auth/function-access";
2727
import { HostContextProvider } from "../auth/host-context-provider";
2828
import { isValidFunctionName, RateLimiter, RateLimiterConfig, UserRateLimiter } from "../auth/rate-limiter";
@@ -377,13 +377,16 @@ class GitpodJsonRpcProxyFactory<T extends object> extends JsonRpcProxyFactory<T>
377377
protected async onRequest(method: string, ...args: any[]): Promise<any> {
378378
const span = TraceContext.startSpan(method, undefined);
379379
const userId = this.clientMetadata.userId;
380-
const rpcSignal = args[args.length - 1];
381-
const signal = rpcSignal ? (rpcSignal as AbortSignal) : new AbortController().signal;
380+
const abortController = new AbortController();
381+
const cancellationToken = args[args.length - 1];
382+
if (CancellationToken.is(cancellationToken)) {
383+
cancellationToken.onCancellationRequested(() => abortController.abort());
384+
}
382385
return runWithRequestContext(
383386
{
384387
requestKind: "jsonrpc",
385388
requestMethod: method,
386-
signal,
389+
signal: abortController.signal,
387390
subjectId: userId ? SubjectId.fromUserId(userId) : undefined,
388391
traceId: span.context().toTraceId(),
389392
},

0 commit comments

Comments
 (0)