1
0
Fork 0
mirror of https://code.sup39.dev/repos/Wqawg synced 2024-12-27 18:04:53 +09:00

Vocab & UI: Repo, Deck and Loom now serve their collabs URI

This commit is contained in:
Pere Lev 2023-06-28 01:09:35 +03:00
parent b2657589dd
commit c98d8d1cc0
No known key found for this signature in database
GPG key ID: 5252C5C863E5E57D
8 changed files with 68 additions and 33 deletions

View file

@ -171,6 +171,8 @@ getDeckR deckHash = do
}
}
, AP.ticketTrackerTeam = Nothing
, AP.ticketTrackerCollaborators =
encodeRouteLocal $ DeckCollabsR deckHash
}
followButton =
followW

View file

@ -112,7 +112,8 @@ getLoomR loomHash = do
hashSigKey <- getEncodeKeyHashid
perActor <- asksSite $ appPerActorKeys . appSettings
let route mk = encodeRouteLocal $ mk loomHash
loomAP = AP.Actor
loomAP = AP.PatchTracker
{ AP.patchTrackerActor = AP.Actor
{ AP.actorLocal = AP.ActorLocal
{ AP.actorId = route LoomR
, AP.actorInbox = route LoomInboxR
@ -133,6 +134,9 @@ getLoomR loomHash = do
, AP.actorSummary = Just $ actorDesc actor
}
}
, AP.patchTrackerCollaborators =
encodeRouteLocal $ LoomCollabsR loomHash
}
provideHtmlAndAP loomAP $ redirect $ LoomClothsR loomHash

View file

@ -232,6 +232,7 @@ getRepoR repoHash = do
, AP.repoLoom =
encodeRouteLocal . LoomR . hashLoom <$> repoLoom repo
, AP.repoClone = encodeRouteLocal (RepoR repoHash) :| []
, AP.repoCollaborators = encodeRouteLocal $ RepoCollabsR repoHash
}
next =

View file

@ -42,6 +42,7 @@ module Web.ActivityPub
, Actor (..)
, Repo (..)
, TicketTracker (..)
, PatchTracker (..)
, CollectionType (..)
, Collection (..)
, CollectionPageType (..)
@ -639,6 +640,7 @@ data Repo u = Repo
, repoVcs :: VersionControlSystem
, repoLoom :: Maybe LocalURI
, repoClone :: NonEmpty LocalURI
, repoCollaborators :: LocalURI
}
instance ActivityPub Repo where
@ -653,16 +655,19 @@ instance ActivityPub Repo where
<*> o .: "versionControlSystem"
<*> withAuthorityMaybeO h (o .:? "sendPatchesTo")
<*> (traverse (withAuthorityO h . pure) =<< o .:*+ "cloneUri")
toSeries authority (Repo actor team vcs loom clone)
= toSeries authority actor
<> "team" .= (ObjURI authority <$> team)
<*> withAuthorityO h (o .: "collaborators")
toSeries h (Repo actor team vcs loom clone collabs)
= toSeries h actor
<> "team" .= (ObjURI h <$> team)
<> "versionControlSystem" .= vcs
<> "sendPatchesTo" .=? (ObjURI authority <$> loom)
<> "cloneUri" .=*+ (ObjURI authority <$> clone)
<> "sendPatchesTo" .=? (ObjURI h <$> loom)
<> "cloneUri" .=*+ (ObjURI h <$> clone)
<> "collaborators" .= ObjURI h collabs
data TicketTracker u = TicketTracker
{ ticketTrackerActor :: Actor u
, ticketTrackerTeam :: Maybe LocalURI
, ticketTrackerCollaborators :: LocalURI
}
instance ActivityPub TicketTracker where
@ -674,9 +679,29 @@ instance ActivityPub TicketTracker where
fmap (h,) $
TicketTracker a
<$> withAuthorityMaybeO h (o .:|? "team")
toSeries authority (TicketTracker actor team)
= toSeries authority actor
<> "team" .= (ObjURI authority <$> team)
<*> withAuthorityO h (o .: "collaborators")
toSeries h (TicketTracker actor team collabs)
= toSeries h actor
<> "team" .= (ObjURI h <$> team)
<> "collaborators" .= ObjURI h collabs
data PatchTracker u = PatchTracker
{ patchTrackerActor :: Actor u
, patchTrackerCollaborators :: LocalURI
}
instance ActivityPub PatchTracker where
jsonldContext _ = [as2Context, secContext, forgeContext]
parseObject o = do
(h, a) <- parseObject o
unless (actorType (actorDetail a) == ActorTypePatchTracker) $
fail "Actor type isn't PatchTracker"
fmap (h,) $
PatchTracker a
<$> withAuthorityO h (o .: "collaborators")
toSeries h (PatchTracker actor collabs)
= toSeries h actor
<> "collaborators" .= ObjURI h collabs
data CollectionType = CollectionTypeUnordered | CollectionTypeOrdered

View file

@ -1,6 +1,6 @@
$# This file is part of Vervis.
$#
$# Written in 2019, 2022 by fr33domlover <fr33domlover@riseup.net>.
$# Written in 2019, 2022, 2023 by fr33domlover <fr33domlover@riseup.net>.
$#
$# ♡ Copying is an act of love. Please copy, reuse and share.
$#

View file

@ -1,6 +1,6 @@
$# This file is part of Vervis.
$#
$# Written in 2019, 2022 by fr33domlover <fr33domlover@riseup.net>.
$# Written in 2019, 2022, 2023 by fr33domlover <fr33domlover@riseup.net>.
$#
$# ♡ Copying is an act of love. Please copy, reuse and share.
$#
@ -28,10 +28,11 @@ $# <http://creativecommons.org/publicdomain/zero/1.0/>.
<a href=@{LoomFollowersR loomHash}>
[🐤 Followers]
<span>
<a href=@{LoomCollabsR loomHash}>
[🤝 Collaborators]
<span>
<a href=@{LoomClothsR loomHash}>
[🧩 Merge Requests]
[🥂 Merge Requests]
<span>
<a href=@{RepoR $ hashRepo $ loomRepo loom}>
[🗃 Repository]

View file

@ -1,6 +1,6 @@
$# This file is part of Vervis.
$#
$# Written in 2016, 2018, 2019, 2020, 2022
$# Written in 2016, 2018, 2019, 2020, 2022, 2023
$# by fr33domlover <fr33domlover@riseup.net>.
$#
$# ♡ Copying is an act of love. Please copy, reuse and share.
@ -46,6 +46,7 @@ $# ^{personNavW user}
<a href=@{RepoFollowersR repo}>
[🐤 Followers]
<span>
<a href=@{RepoCollabsR repo}>
[🤝 Collaborators]
<span>
<a href=@{RepoCommitsR repo}>

View file

@ -1,6 +1,6 @@
$# This file is part of Vervis.
$#
$# Written in 2016, 2018, 2019, 2020, 2022
$# Written in 2016, 2018, 2019, 2020, 2022, 2023
$# by fr33domlover <fr33domlover@riseup.net>.
$#
$# ♡ Copying is an act of love. Please copy, reuse and share.
@ -46,6 +46,7 @@ $# ^{personNavW user}
<a href=@{RepoFollowersR repo}>
[🐤 Followers]
<span>
<a href=@{RepoCollabsR repo}>
[🤝 Collaborators]
<span>
<a href=@{RepoCommitsR repo}>