diff --git a/modules/relay/src/main/RelayApi.scala b/modules/relay/src/main/RelayApi.scala index d8711936a8315..5e1347d642bdf 100644 --- a/modules/relay/src/main/RelayApi.scala +++ b/modules/relay/src/main/RelayApi.scala @@ -379,14 +379,13 @@ final class RelayApi( yield rt.tour.some def deleteTourIfOwner(tour: RelayTour)(using me: Me): Fu[Boolean] = - (tour.isOwnedBy(me) || Granter(_.StudyAdmin)) - .so: - for - _ <- tourRepo.delete(tour) - rounds <- roundRepo.idsByTourOrdered(tour.id) - _ <- roundRepo.deleteByTour(tour) - _ <- rounds.map(_.into(StudyId)).sequentiallyVoid(studyApi.deleteById) - yield true + ((tour.isOwnedBy(me) || Granter(_.StudyAdmin)) && !tour.official).so: + for + _ <- tourRepo.delete(tour) + rounds <- roundRepo.idsByTourOrdered(tour.id) + _ <- roundRepo.deleteByTour(tour) + _ <- rounds.map(_.into(StudyId)).sequentiallyVoid(studyApi.deleteById) + yield true def canUpdate(tour: RelayTour)(using me: Me): Fu[Boolean] = fuccess(Granter(_.StudyAdmin) || tour.isOwnedBy(me)) >>|