Fix managers can't upload team pics (for real)
Some checks failed
Tests and checks on push / run-checks-and-tests (push) Has been cancelled
Updates translation progress / update-translation-progress-issue (push) Has been cancelled

This commit is contained in:
Kalle 2025-02-08 13:30:19 +02:00
parent e1653c9d9e
commit aec350281e

View File

@ -97,14 +97,9 @@ async function validatedTeam({
});
const team = await TeamRepository.findByCustomUrl(teamCustomUrl);
validate(team, "You must be on a team to upload images");
validate(team, "Team not found");
validate(
team.members.some((member) => member.id === user.id && member.isOwner),
"You must be on the team to upload images",
);
const detailedTeam = await TeamRepository.findByCustomUrl(team.customUrl);
validate(
detailedTeam && isTeamManager({ team: detailedTeam, user }),
isTeamManager({ team, user }),
"You must be the team manager to upload images",
);