Skip to content

Commit

Permalink
wrap recent repos w/ repo search flag check
Browse files Browse the repository at this point in the history
  • Loading branch information
selfcontained committed Oct 4, 2023
1 parent 84b26a0 commit 9eafa25
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { RepoURL } from "../repohost";
import { RepositoryProvider } from "../repohost/repository-provider";
import { BitbucketServerApi } from "./bitbucket-server-api";
import { log } from "@gitpod/gitpod-protocol/lib/util/logging";
import { getExperimentsClientForBackend } from "@gitpod/gitpod-protocol/lib/experiments/configcat-server";

@injectable()
export class BitbucketServerRepositoryProvider implements RepositoryProvider {
Expand Down Expand Up @@ -145,8 +146,20 @@ export class BitbucketServerRepositoryProvider implements RepositoryProvider {
}

async getUserRepos(user: User): Promise<RepositoryInfo[]> {
const repoSearchEnabled = await getExperimentsClientForBackend().getValueAsync(
"repositoryFinderSearch",
false,
{
user,
},
);

try {
const repos = await this.api.getRecentRepos(user, { limit: 25 });
const repos = repoSearchEnabled
? // Get up to 100 of the most recent repos if repo searching is enabled
await this.api.getRecentRepos(user, { limit: 100 })
: // Otherwise continue to get up to 10k repos
await this.api.getRepos(user, { maxPages: 10, permission: "REPO_READ" });

const result: RepositoryInfo[] = [];
repos.forEach((r) => {
Expand Down

0 comments on commit 9eafa25

Please sign in to comment.