From bef8a77d8446932b7cfc9659405bdee8bbd841d5 Mon Sep 17 00:00:00 2001 From: Pere Lev Date: Sun, 12 May 2024 21:46:34 +0300 Subject: [PATCH] UI: Browse: List team parents --- src/Vervis/Handler/Client.hs | 32 ++++++++++++++++++++++++++++---- templates/browse.hamlet | 9 ++++++++- 2 files changed, 36 insertions(+), 5 deletions(-) diff --git a/src/Vervis/Handler/Client.hs b/src/Vervis/Handler/Client.hs index 2627531..6b28ca1 100644 --- a/src/Vervis/Handler/Client.hs +++ b/src/Vervis/Handler/Client.hs @@ -408,10 +408,34 @@ getBrowseR = do E.orderBy [E.asc $ person E.^. PersonId] return (person, actor) ) - <*> (E.select $ E.from $ \ (group `E.InnerJoin` actor) -> do - E.on $ group E.^. GroupActor E.==. actor E.^. ActorId - E.orderBy [E.asc $ group E.^. GroupId] - return (group, actor) + <*> (do js <- + E.select $ E.from $ \ (group `E.InnerJoin` actor) -> do + E.on $ group E.^. GroupActor E.==. actor E.^. ActorId + E.orderBy [E.asc $ group E.^. GroupId] + return (group, actor) + for js $ \ (j@(Entity groupID _), jactor) -> do + parents <- E.select $ E.from $ \ (deleg `E.InnerJoin` holder) -> do + E.on $ deleg E.^. SourceUsSendDelegatorSource E.==. holder E.^. SourceHolderGroupSource + E.where_ $ holder E.^. SourceHolderGroupGroup E.==. E.val groupID + return $ holder E.^. SourceHolderGroupSource + parents' <- for parents $ \ (E.Value sourceID) -> do + byKeyOrRaid <- bimap snd snd <$> getSourceTopic sourceID + bitraverse + (\case + Left _j -> error "I'm a group and I have a parent who is a local Project" + Right g -> do + actorID <- groupActor <$> getJust g + actor <- getJust actorID + return (g, actor) + ) + (\ remoteActorID -> do + remoteActor <- getJust remoteActorID + remoteObject <- getJust $ remoteActorIdent remoteActor + inztance <- getJust $ remoteObjectInstance remoteObject + return (inztance, remoteObject, remoteActor) + ) + byKeyOrRaid + return (j, jactor, parents') ) <*> (E.select $ E.from $ \ (repo `E.InnerJoin` actor) -> do E.on $ repo E.^. RepoActor E.==. actor E.^. ActorId diff --git a/templates/browse.hamlet b/templates/browse.hamlet index f36873f..b76332d 100644 --- a/templates/browse.hamlet +++ b/templates/browse.hamlet @@ -81,10 +81,17 @@ $# #forgefed @ Libera Chat

Teams