UI: Browse: List team parents

This commit is contained in:
Pere Lev 2024-05-12 21:46:34 +03:00
parent 74af2ea223
commit bef8a77d84
No known key found for this signature in database
GPG key ID: 5252C5C863E5E57D
2 changed files with 36 additions and 5 deletions

View file

@ -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
<*> (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

View file

@ -81,10 +81,17 @@ $# #forgefed @ Libera Chat
<h2>Teams
<ul>
$forall (Entity groupID _, Entity _ actor) <- groups
$forall (Entity groupID _, Entity _ actor, parents) <- groups
<li>
<a href=@{GroupR $ hashGroup groupID}>
&#{keyHashidText $ hashGroup groupID} #{actorName actor}
<ul>
$if not $ null parents
<li>Parents
<ul>
$forall p <- parents
<li>
^{groupLinkFedW p}
<h2>Repos