~jan0sch/smederee

Showing details for patch d163ec70ec3fe12884f1bc06b4accda873fedf48.
2024-06-21 (Fri), 3:50 PM - Jens Grassel - d163ec70ec3fe12884f1bc06b4accda873fedf48

hub: Fix issue with "edit organisation settings" link always shown.

- create list of organisation administrators correctly

Fixes: https://smeder.ee/~jan0sch/smederee/tickets/12
Summary of changes
1 files modified with 4 lines added and 1 lines removed
  • modules/hub/src/main/scala/de/smederee/hub/VcsRepositoryRoutes.scala with 4 added and 1 removed lines
diff -rN -u old-smederee/modules/hub/src/main/scala/de/smederee/hub/VcsRepositoryRoutes.scala new-smederee/modules/hub/src/main/scala/de/smederee/hub/VcsRepositoryRoutes.scala
--- old-smederee/modules/hub/src/main/scala/de/smederee/hub/VcsRepositoryRoutes.scala	2025-01-11 11:39:23.013823471 +0000
+++ new-smederee/modules/hub/src/main/scala/de/smederee/hub/VcsRepositoryRoutes.scala	2025-01-11 11:39:23.013823471 +0000
@@ -321,7 +321,10 @@
                 )
             )
             possibleOrgaAdmins <- organisation.map(_.oid).traverse(id => orgRepo.getAdministrators(id).compile.toList)
-            organisationAdmins = user.map(u => List(u)).getOrElse(Nil) ::: possibleOrgaAdmins.getOrElse(Nil)
+            organisationOwner  <- organisation.map(_.oid).traverse(orgRepo.findOwner)
+            organisationAdmins = organisationOwner.flatten
+                .map(account => List(account))
+                .getOrElse(Nil) ::: possibleOrgaAdmins.getOrElse(Nil)
             resp <- (owner, organisation) match {
                 case (Some(owner), organisation) =>
                     loadRepos(owner).compile.toList.flatMap { repos =>