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

[teams] Can create new team with deleted team name #6273

Merged
merged 1 commit into from
Oct 18, 2021
Merged
Show file tree
Hide file tree
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
3 changes: 1 addition & 2 deletions components/dashboard/src/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export default function Menu() {
const { user } = useContext(UserContext);
const { teams } = useContext(TeamsContext);
const location = useLocation();
const visibleTeams = teams?.filter(team => { return Boolean(!team.markedDeleted) });

const match = useRouteMatch<{ segment1?: string, segment2?: string, segment3?: string }>("/(t/)?:segment1/:segment2?/:segment3?");
const projectName = (() => {
Expand Down Expand Up @@ -192,7 +191,7 @@ export default function Menu() {
separator: true,
link: '/',
},
...(visibleTeams || []).map(t => ({
...(teams || []).map(t => ({
title: t.name,
customContent: <div className="w-full text-gray-400 flex flex-col">
<span className="text-gray-800 dark:text-gray-300 text-base font-semibold">{t.name}</span>
Expand Down
4 changes: 2 additions & 2 deletions components/gitpod-db/src/typeorm/team-db-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export class TeamDBImpl implements TeamDB {

public async findTeamById(teamId: string): Promise<Team | undefined> {
const teamRepo = await this.getTeamRepo();
return teamRepo.findOne({ id: teamId, deleted: false });
return teamRepo.findOne({ id: teamId, deleted: false, markedDeleted: false});
}

public async findMembersByTeam(teamId: string): Promise<TeamMemberInfo[]> {
Expand Down Expand Up @@ -123,7 +123,7 @@ export class TeamDBImpl implements TeamDB {
throw new Error('A team cannot have the same name as an existing user');
}
const teamRepo = await this.getTeamRepo();
const existingTeam = await teamRepo.findOne({ slug, deleted: false });
const existingTeam = await teamRepo.findOne({ slug, deleted: false, markedDeleted: false });
if (!!existingTeam) {
throw new Error('A team with this name already exists');
}
Expand Down