UI, Vocab: Link from project/team to children & parents pages

This commit is contained in:
Pere Lev 2023-12-13 00:09:28 +02:00
parent 802df6b15b
commit ab786eb67c
No known key found for this signature in database
GPG key ID: 5252C5C863E5E57D
5 changed files with 28 additions and 44 deletions

View file

@ -196,8 +196,8 @@ getGroupR groupHash = do
} }
groupAP = AP.Team groupAP = AP.Team
{ AP.teamActor = actorAP { AP.teamActor = actorAP
, AP.teamChildren = [] , AP.teamChildren = encodeRouteLocal $ GroupChildrenR groupHash
, AP.teamParents = [] , AP.teamParents = encodeRouteLocal $ GroupParentsR groupHash
, AP.teamMembers = encodeRouteLocal $ GroupMembersR groupHash , AP.teamMembers = encodeRouteLocal $ GroupMembersR groupHash
} }

View file

@ -159,8 +159,8 @@ getProjectR projectHash = do
} }
} }
, AP.projectTracker = Nothing , AP.projectTracker = Nothing
, AP.projectChildren = [] , AP.projectChildren = encodeRouteLocal $ ProjectChildrenR projectHash
, AP.projectParents = [] , AP.projectParents = encodeRouteLocal $ ProjectParentsR projectHash
, AP.projectComponents = , AP.projectComponents =
encodeRouteLocal $ ProjectComponentsR projectHash encodeRouteLocal $ ProjectComponentsR projectHash
, AP.projectCollaborators = , AP.projectCollaborators =

View file

@ -880,8 +880,8 @@ instance ActivityPub ResourceWithCollections where
data Project u = Project data Project u = Project
{ projectActor :: Actor u { projectActor :: Actor u
, projectTracker :: Maybe (ObjURI u) , projectTracker :: Maybe (ObjURI u)
, projectChildren :: [ObjURI u] , projectChildren :: LocalURI
, projectParents :: [ObjURI u] , projectParents :: LocalURI
, projectComponents :: LocalURI , projectComponents :: LocalURI
, projectCollaborators :: LocalURI , projectCollaborators :: LocalURI
} }
@ -895,36 +895,22 @@ instance ActivityPub Project where
fmap (h,) $ fmap (h,) $
Project a Project a
<$> o .:? "ticketsTrackedBy" <$> o .:? "ticketsTrackedBy"
<*> (do c <- o .: "subprojects" <*> withAuthorityO h (o .: "subprojects")
typ <- c .: "type" <*> withAuthorityO h (o .: "context")
unless (typ == ("Collection" :: Text)) $
fail "subprojects.type isn't Collection"
items <- c .: "items"
mtotal <- c .:? "totalItems"
for_ mtotal $ \ total ->
unless (length items == total) $
fail "Incorrect totalItems"
return items
)
<*> o .:? "context" .!= []
<*> withAuthorityO h (o .: "components") <*> withAuthorityO h (o .: "components")
<*> withAuthorityO h (o .: "collaborators") <*> withAuthorityO h (o .: "collaborators")
toSeries h (Project actor tracker children parents components collabs) toSeries h (Project actor tracker children parents components collabs)
= toSeries h actor = toSeries h actor
<> "ticketsTrackedBy" .=? tracker <> "ticketsTrackedBy" .=? tracker
<> "subprojects" `pair` pairs <> "subprojects" .= ObjURI h children
( "type" .= ("Collection" :: Text) <> "context" .= ObjURI h parents
<> "items" .= children
<> "totalItems" .= length children
)
<> "context" .= parents
<> "components" .= ObjURI h components <> "components" .= ObjURI h components
<> "collaborators" .= ObjURI h collabs <> "collaborators" .= ObjURI h collabs
data Team u = Team data Team u = Team
{ teamActor :: Actor u { teamActor :: Actor u
, teamChildren :: [ObjURI u] , teamChildren :: LocalURI
, teamParents :: [ObjURI u] , teamParents :: LocalURI
, teamMembers :: LocalURI , teamMembers :: LocalURI
} }
@ -936,27 +922,13 @@ instance ActivityPub Team where
fail "Actor type isn't Team" fail "Actor type isn't Team"
fmap (h,) $ fmap (h,) $
Team a Team a
<$> (do c <- o .: "subteams" <$> withAuthorityO h (o .: "subteams")
typ <- c .: "type" <*> withAuthorityO h (o .: "context")
unless (typ == ("Collection" :: Text)) $
fail "subteams.type isn't Collection"
items <- c .: "items"
mtotal <- c .:? "totalItems"
for_ mtotal $ \ total ->
unless (length items == total) $
fail "Incorrect totalItems"
return items
)
<*> o .:? "context" .!= []
<*> withAuthorityO h (o .: "members") <*> withAuthorityO h (o .: "members")
toSeries h (Team actor children parents members) toSeries h (Team actor children parents members)
= toSeries h actor = toSeries h actor
<> "subteams" `pair` pairs <> "subteams" .= ObjURI h children
( "type" .= ("Collection" :: Text) <> "context" .= ObjURI h parents
<> "items" .= children
<> "totalItems" .= length children
)
<> "context" .= parents
<> "members" .= ObjURI h members <> "members" .= ObjURI h members
data Audience u = Audience data Audience u = Audience

View file

@ -30,5 +30,11 @@ $# <http://creativecommons.org/publicdomain/zero/1.0/>.
<span> <span>
<a href=@{GroupMembersR groupHash}> <a href=@{GroupMembersR groupHash}>
[🤝 Members] [🤝 Members]
<span>
<a href=@{GroupChildrenR groupHash}>
[🐛 Children]
<span>
<a href=@{GroupParentsR groupHash}>
[🦋 Parents]
<span> <span>
[✏ Edit] [✏ Edit]

View file

@ -33,6 +33,12 @@ $# <http://creativecommons.org/publicdomain/zero/1.0/>.
<span> <span>
<a href=@{ProjectComponentsR projectHash}> <a href=@{ProjectComponentsR projectHash}>
[🧩 Components] [🧩 Components]
<span>
<a href=@{ProjectChildrenR projectHash}>
[🐛 Children]
<span>
<a href=@{ProjectParentsR projectHash}>
[🦋 Parents]
<span> <span>
[No wiki] [No wiki]
<span> <span>