Skip to content

Commit

Permalink
[server] make unused getProviderRepositoriesForUser a no-op
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexTugarev committed Nov 15, 2023
1 parent 5400f64 commit ee0c883
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 44 deletions.
1 change: 1 addition & 0 deletions components/gitpod-protocol/src/gitpod-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
getOnboardingState(): Promise<GitpodServer.OnboardingState>;

// Projects
/** @deprecated no-op */
getProviderRepositoriesForUser(
params: GetProviderRepositoriesParams,
cancellationToken?: CancellationToken,
Expand Down
50 changes: 6 additions & 44 deletions components/server/src/workspace/gitpod-server-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,6 @@ import { LinkedInService } from "../linkedin-service";
import { SnapshotService, WaitForSnapshotOptions } from "./snapshot-service";
import { IncrementalWorkspaceService } from "../prebuilds/incremental-workspace-service";
import { PrebuildManager } from "../prebuilds/prebuild-manager";
import { GitHubAppSupport } from "../github/github-app-support";
import { GitLabAppSupport } from "../gitlab/gitlab-app-support";
import { BitbucketAppSupport } from "../bitbucket/bitbucket-app-support";
import { StripeService } from "../billing/stripe-service";
import {
BillingServiceClient,
Expand Down Expand Up @@ -195,10 +192,6 @@ export class GitpodServerImpl implements GitpodServerWithTracing, Disposable {
@inject(ContextParser) private contextParser: ContextParser,
@inject(HostContextProvider) private readonly hostContextProvider: HostContextProvider,

@inject(GitHubAppSupport) private readonly githubAppSupport: GitHubAppSupport,
@inject(GitLabAppSupport) private readonly gitLabAppSupport: GitLabAppSupport,
@inject(BitbucketAppSupport) private readonly bitbucketAppSupport: BitbucketAppSupport,

@inject(PrebuildManager) private readonly prebuildManager: PrebuildManager,
@inject(IncrementalWorkspaceService) private readonly incrementalPrebuildsService: IncrementalWorkspaceService,
@inject(ConfigProvider) private readonly configProvider: ConfigProvider,
Expand Down Expand Up @@ -1263,50 +1256,19 @@ export class GitpodServerImpl implements GitpodServerWithTracing, Disposable {
);
}

// Projects
/**
*
* @deprecated
*/
async getProviderRepositoriesForUser(
ctx: TraceContext,
params: GetProviderRepositoriesParams,
cancellationToken?: CancellationToken,
): Promise<ProviderRepository[]> {
traceAPIParams(ctx, { params });

const user = await this.checkAndBlockUser("getProviderRepositoriesForUser");

const repositories: ProviderRepository[] = [];
const providerHost = params.provider;
const provider = (await this.getAuthProviders(ctx)).find((ap) => ap.host === providerHost);

if (providerHost === "github.com" && this.config.githubApp?.enabled) {
repositories.push(...(await this.githubAppSupport.getProviderRepositoriesForUser({ user, ...params })));
} else if (provider?.authProviderType === "GitHub") {
const hostContext = this.hostContextProvider.get(providerHost);
if (hostContext?.services) {
repositories.push(
...(await hostContext.services.repositoryService.getRepositoriesForAutomatedPrebuilds(user, {})),
);
}
} else if (providerHost === "bitbucket.org" && provider) {
repositories.push(...(await this.bitbucketAppSupport.getProviderRepositoriesForUser({ user, provider })));
} else if (provider?.authProviderType === "BitbucketServer") {
const hostContext = this.hostContextProvider.get(providerHost);
if (hostContext?.services) {
repositories.push(
...(await hostContext.services.repositoryService.getRepositoriesForAutomatedPrebuilds(user, {
searchString: params.searchString,
cancellationToken,
limit: params.limit,
maxPages: params.maxPages,
})),
);
}
} else if (provider?.authProviderType === "GitLab") {
repositories.push(...(await this.gitLabAppSupport.getProviderRepositoriesForUser({ user, provider })));
} else {
log.info({ userId: user.id }, `Unsupported provider: "${params.provider}"`, { params });
}

return repositories;
await this.checkAndBlockUser("getProviderRepositoriesForUser");
return [];
}

async triggerPrebuild(
Expand Down

0 comments on commit ee0c883

Please sign in to comment.