mirror of
https://code.sup39.dev/repos/Wqawg
synced 2024-12-27 03:14:53 +09:00
Vocab & UI: Repo, Deck and Loom now serve their collabs URI
This commit is contained in:
parent
b2657589dd
commit
c98d8d1cc0
8 changed files with 68 additions and 33 deletions
|
@ -171,6 +171,8 @@ getDeckR deckHash = do
|
|||
}
|
||||
}
|
||||
, AP.ticketTrackerTeam = Nothing
|
||||
, AP.ticketTrackerCollaborators =
|
||||
encodeRouteLocal $ DeckCollabsR deckHash
|
||||
}
|
||||
followButton =
|
||||
followW
|
||||
|
|
|
@ -112,26 +112,30 @@ getLoomR loomHash = do
|
|||
hashSigKey <- getEncodeKeyHashid
|
||||
perActor <- asksSite $ appPerActorKeys . appSettings
|
||||
let route mk = encodeRouteLocal $ mk loomHash
|
||||
loomAP = AP.Actor
|
||||
{ AP.actorLocal = AP.ActorLocal
|
||||
{ AP.actorId = route LoomR
|
||||
, AP.actorInbox = route LoomInboxR
|
||||
, AP.actorOutbox = Just $ route LoomOutboxR
|
||||
, AP.actorFollowers = Just $ route LoomFollowersR
|
||||
, AP.actorFollowing = Nothing
|
||||
, AP.actorPublicKeys =
|
||||
map (Left . encodeRouteLocal) $
|
||||
if perActor
|
||||
then map (LoomStampR loomHash . hashSigKey) sigKeyIDs
|
||||
else [ActorKey1R, ActorKey2R]
|
||||
, AP.actorSshKeys = []
|
||||
}
|
||||
, AP.actorDetail = AP.ActorDetail
|
||||
{ AP.actorType = AP.ActorTypePatchTracker
|
||||
, AP.actorUsername = Nothing
|
||||
, AP.actorName = Just $ actorName actor
|
||||
, AP.actorSummary = Just $ actorDesc actor
|
||||
loomAP = AP.PatchTracker
|
||||
{ AP.patchTrackerActor = AP.Actor
|
||||
{ AP.actorLocal = AP.ActorLocal
|
||||
{ AP.actorId = route LoomR
|
||||
, AP.actorInbox = route LoomInboxR
|
||||
, AP.actorOutbox = Just $ route LoomOutboxR
|
||||
, AP.actorFollowers = Just $ route LoomFollowersR
|
||||
, AP.actorFollowing = Nothing
|
||||
, AP.actorPublicKeys =
|
||||
map (Left . encodeRouteLocal) $
|
||||
if perActor
|
||||
then map (LoomStampR loomHash . hashSigKey) sigKeyIDs
|
||||
else [ActorKey1R, ActorKey2R]
|
||||
, AP.actorSshKeys = []
|
||||
}
|
||||
, AP.actorDetail = AP.ActorDetail
|
||||
{ AP.actorType = AP.ActorTypePatchTracker
|
||||
, AP.actorUsername = Nothing
|
||||
, AP.actorName = Just $ actorName actor
|
||||
, AP.actorSummary = Just $ actorDesc actor
|
||||
}
|
||||
}
|
||||
, AP.patchTrackerCollaborators =
|
||||
encodeRouteLocal $ LoomCollabsR loomHash
|
||||
}
|
||||
|
||||
provideHtmlAndAP loomAP $ redirect $ LoomClothsR loomHash
|
||||
|
|
|
@ -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 =
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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.
|
||||
$#
|
||||
|
|
|
@ -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>
|
||||
[🤝 Collaborators]
|
||||
<a href=@{LoomCollabsR loomHash}>
|
||||
[🤝 Collaborators]
|
||||
<span>
|
||||
<a href=@{LoomClothsR loomHash}>
|
||||
[🧩 Merge Requests]
|
||||
[🥂 Merge Requests]
|
||||
<span>
|
||||
<a href=@{RepoR $ hashRepo $ loomRepo loom}>
|
||||
[🗃 Repository]
|
||||
|
|
|
@ -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}>
|
||||
|
|
|
@ -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}>
|
||||
|
|
Loading…
Reference in a new issue