Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove FORBIDDEN_SLUGS #7320

Merged
merged 2 commits into from
Jan 5, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 1 addition & 34 deletions components/gitpod-db/src/typeorm/team-db-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,39 +16,6 @@ import { DBTeamMembership } from "./entity/db-team-membership";
import { DBUser } from "./entity/db-user";
import { DBTeamMembershipInvite } from "./entity/db-team-membership-invite";

const FORBIDDEN_SLUGS = [
'access-control',
'account',
'admin',
'blocked',
'branches',
'from-referrer',
'install-github-app',
'integrations',
'issues',
'login',
'merge-requests',
'new',
'notifications',
'oauth-approval',
'plans',
'prebuilds',
'preferences',
'projects',
'pull-requests',
'settings',
'setup',
'snapshots',
'sorry',
'start',
'subscription',
'teams',
'upgrade-subscription',
'usage',
'variables',
'workspaces',
...(blocklist),
].sort((a, b) => b > a ? -1 : 1);

@injectable()
export class TeamDBImpl implements TeamDB {
Expand Down Expand Up @@ -129,7 +96,7 @@ export class TeamDBImpl implements TeamDB {
throw new Error('Please choose a team name containing only letters, numbers, -, _, \', or spaces.');
}
const slug = name.toLocaleLowerCase().replace(/[ ']/g, '-');
if (FORBIDDEN_SLUGS.indexOf(slug) !== -1) {
if (blocklist.indexOf(slug) !== -1) {
throw new Error('Creating a team with this name is not allowed');
}
const userRepo = await this.getUserRepo();
Expand Down