mirror of
https://code.sup39.dev/repos/Wqawg
synced 2024-12-27 17:34:52 +09:00
UI, Vocab: Link from project/team to children & parents pages
This commit is contained in:
parent
802df6b15b
commit
ab786eb67c
5 changed files with 28 additions and 44 deletions
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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 =
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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]
|
||||||
|
|
|
@ -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>
|
||||||
|
|
Loading…
Reference in a new issue