Skip to content

Commit 2584796

Browse files
committed
copilot review
1 parent 7fdc4a8 commit 2584796

6 files changed

Lines changed: 11 additions & 7 deletions

File tree

backend/src/entities/project.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { Team } from "./team";
1212
export class Project {
1313
@PrimaryGeneratedColumn()
1414
public readonly id!: number;
15-
@ManyToOne(() => Team, { eager: true, onDelete: "SET NULL" })
15+
@ManyToOne(() => Team, { eager: true, onDelete: "CASCADE" })
1616
@JoinColumn()
1717
public team!: Team;
1818
@Column({ length: 1024 })

backend/src/services/team-service.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,11 @@ export class TeamService implements ITeamService {
122122

123123
const originalTeamUserIds = originalTeam?.userIds();
124124

125-
if (!originalTeamUserIds!.includes(user.id)) {
125+
// TODO test that admins and members can change the title, but not othe users
126+
if (
127+
user.role !== UserRole.Root &&
128+
!originalTeamUserIds!.includes(user.id)
129+
) {
126130
throw new Error("You are not a member of this team");
127131
}
128132

docs/docs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ services:
7676
# a tilt example
7777
- MARIADB_DATABASE=tilt
7878
- MARIADB_USER=tilt
79-
# genereate a password, as this one is shown publicly
79+
# generate a password, as this one is shown publicly
8080
# in this repository
8181
- MARIADB_PASSWORD=this_is_not_secure_generate_something
8282

frontend/src/components/base/button.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ interface IButtonProps {
6767
primary?: boolean;
6868
loading?: boolean;
6969
color?: string;
70-
style?: Record<string, any>;
70+
style?: React.CSSProperties;
7171
}
7272

7373
/**

frontend/src/components/pages/edit-team.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ export const EditTeam = ({
158158
}
159159
return false;
160160
},
161-
[team, title, description, image, showNotification],
161+
[team, title, description, image, showNotification, onChange],
162162
);
163163

164164
const acceptUserToTeam = async (userToAccept: UserListDto) => {

frontend/src/components/pages/view-team.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ export const ViewTeam = () => {
2525
return team?.users?.some((u) => u.id === user?.id) ?? false;
2626
}, [team, user?.id]);
2727

28-
const reloadTeam = async () => {
28+
const reloadTeam = React.useCallback(async () => {
2929
await api.getTeamByID(teamId).then((team_) => setTeam(team_));
30-
};
30+
}, []);
3131

3232
const isAdmin = user?.role === UserRole.Root;
3333

0 commit comments

Comments
 (0)