mirror of
https://code.sup39.dev/repos/Wqawg
synced 2024-12-27 18:24:51 +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.ticketTrackerTeam = Nothing
|
||||||
|
, AP.ticketTrackerCollaborators =
|
||||||
|
encodeRouteLocal $ DeckCollabsR deckHash
|
||||||
}
|
}
|
||||||
followButton =
|
followButton =
|
||||||
followW
|
followW
|
||||||
|
|
|
@ -112,26 +112,30 @@ getLoomR loomHash = do
|
||||||
hashSigKey <- getEncodeKeyHashid
|
hashSigKey <- getEncodeKeyHashid
|
||||||
perActor <- asksSite $ appPerActorKeys . appSettings
|
perActor <- asksSite $ appPerActorKeys . appSettings
|
||||||
let route mk = encodeRouteLocal $ mk loomHash
|
let route mk = encodeRouteLocal $ mk loomHash
|
||||||
loomAP = AP.Actor
|
loomAP = AP.PatchTracker
|
||||||
{ AP.actorLocal = AP.ActorLocal
|
{ AP.patchTrackerActor = AP.Actor
|
||||||
{ AP.actorId = route LoomR
|
{ AP.actorLocal = AP.ActorLocal
|
||||||
, AP.actorInbox = route LoomInboxR
|
{ AP.actorId = route LoomR
|
||||||
, AP.actorOutbox = Just $ route LoomOutboxR
|
, AP.actorInbox = route LoomInboxR
|
||||||
, AP.actorFollowers = Just $ route LoomFollowersR
|
, AP.actorOutbox = Just $ route LoomOutboxR
|
||||||
, AP.actorFollowing = Nothing
|
, AP.actorFollowers = Just $ route LoomFollowersR
|
||||||
, AP.actorPublicKeys =
|
, AP.actorFollowing = Nothing
|
||||||
map (Left . encodeRouteLocal) $
|
, AP.actorPublicKeys =
|
||||||
if perActor
|
map (Left . encodeRouteLocal) $
|
||||||
then map (LoomStampR loomHash . hashSigKey) sigKeyIDs
|
if perActor
|
||||||
else [ActorKey1R, ActorKey2R]
|
then map (LoomStampR loomHash . hashSigKey) sigKeyIDs
|
||||||
, AP.actorSshKeys = []
|
else [ActorKey1R, ActorKey2R]
|
||||||
}
|
, AP.actorSshKeys = []
|
||||||
, AP.actorDetail = AP.ActorDetail
|
}
|
||||||
{ AP.actorType = AP.ActorTypePatchTracker
|
, AP.actorDetail = AP.ActorDetail
|
||||||
, AP.actorUsername = Nothing
|
{ AP.actorType = AP.ActorTypePatchTracker
|
||||||
, AP.actorName = Just $ actorName actor
|
, AP.actorUsername = Nothing
|
||||||
, AP.actorSummary = Just $ actorDesc actor
|
, AP.actorName = Just $ actorName actor
|
||||||
|
, AP.actorSummary = Just $ actorDesc actor
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
, AP.patchTrackerCollaborators =
|
||||||
|
encodeRouteLocal $ LoomCollabsR loomHash
|
||||||
}
|
}
|
||||||
|
|
||||||
provideHtmlAndAP loomAP $ redirect $ LoomClothsR loomHash
|
provideHtmlAndAP loomAP $ redirect $ LoomClothsR loomHash
|
||||||
|
|
|
@ -232,6 +232,7 @@ getRepoR repoHash = do
|
||||||
, AP.repoLoom =
|
, AP.repoLoom =
|
||||||
encodeRouteLocal . LoomR . hashLoom <$> repoLoom repo
|
encodeRouteLocal . LoomR . hashLoom <$> repoLoom repo
|
||||||
, AP.repoClone = encodeRouteLocal (RepoR repoHash) :| []
|
, AP.repoClone = encodeRouteLocal (RepoR repoHash) :| []
|
||||||
|
, AP.repoCollaborators = encodeRouteLocal $ RepoCollabsR repoHash
|
||||||
}
|
}
|
||||||
|
|
||||||
next =
|
next =
|
||||||
|
|
|
@ -42,6 +42,7 @@ module Web.ActivityPub
|
||||||
, Actor (..)
|
, Actor (..)
|
||||||
, Repo (..)
|
, Repo (..)
|
||||||
, TicketTracker (..)
|
, TicketTracker (..)
|
||||||
|
, PatchTracker (..)
|
||||||
, CollectionType (..)
|
, CollectionType (..)
|
||||||
, Collection (..)
|
, Collection (..)
|
||||||
, CollectionPageType (..)
|
, CollectionPageType (..)
|
||||||
|
@ -639,6 +640,7 @@ data Repo u = Repo
|
||||||
, repoVcs :: VersionControlSystem
|
, repoVcs :: VersionControlSystem
|
||||||
, repoLoom :: Maybe LocalURI
|
, repoLoom :: Maybe LocalURI
|
||||||
, repoClone :: NonEmpty LocalURI
|
, repoClone :: NonEmpty LocalURI
|
||||||
|
, repoCollaborators :: LocalURI
|
||||||
}
|
}
|
||||||
|
|
||||||
instance ActivityPub Repo where
|
instance ActivityPub Repo where
|
||||||
|
@ -653,16 +655,19 @@ instance ActivityPub Repo where
|
||||||
<*> o .: "versionControlSystem"
|
<*> o .: "versionControlSystem"
|
||||||
<*> withAuthorityMaybeO h (o .:? "sendPatchesTo")
|
<*> withAuthorityMaybeO h (o .:? "sendPatchesTo")
|
||||||
<*> (traverse (withAuthorityO h . pure) =<< o .:*+ "cloneUri")
|
<*> (traverse (withAuthorityO h . pure) =<< o .:*+ "cloneUri")
|
||||||
toSeries authority (Repo actor team vcs loom clone)
|
<*> withAuthorityO h (o .: "collaborators")
|
||||||
= toSeries authority actor
|
toSeries h (Repo actor team vcs loom clone collabs)
|
||||||
<> "team" .= (ObjURI authority <$> team)
|
= toSeries h actor
|
||||||
|
<> "team" .= (ObjURI h <$> team)
|
||||||
<> "versionControlSystem" .= vcs
|
<> "versionControlSystem" .= vcs
|
||||||
<> "sendPatchesTo" .=? (ObjURI authority <$> loom)
|
<> "sendPatchesTo" .=? (ObjURI h <$> loom)
|
||||||
<> "cloneUri" .=*+ (ObjURI authority <$> clone)
|
<> "cloneUri" .=*+ (ObjURI h <$> clone)
|
||||||
|
<> "collaborators" .= ObjURI h collabs
|
||||||
|
|
||||||
data TicketTracker u = TicketTracker
|
data TicketTracker u = TicketTracker
|
||||||
{ ticketTrackerActor :: Actor u
|
{ ticketTrackerActor :: Actor u
|
||||||
, ticketTrackerTeam :: Maybe LocalURI
|
, ticketTrackerTeam :: Maybe LocalURI
|
||||||
|
, ticketTrackerCollaborators :: LocalURI
|
||||||
}
|
}
|
||||||
|
|
||||||
instance ActivityPub TicketTracker where
|
instance ActivityPub TicketTracker where
|
||||||
|
@ -674,9 +679,29 @@ instance ActivityPub TicketTracker where
|
||||||
fmap (h,) $
|
fmap (h,) $
|
||||||
TicketTracker a
|
TicketTracker a
|
||||||
<$> withAuthorityMaybeO h (o .:|? "team")
|
<$> withAuthorityMaybeO h (o .:|? "team")
|
||||||
toSeries authority (TicketTracker actor team)
|
<*> withAuthorityO h (o .: "collaborators")
|
||||||
= toSeries authority actor
|
toSeries h (TicketTracker actor team collabs)
|
||||||
<> "team" .= (ObjURI authority <$> team)
|
= 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
|
data CollectionType = CollectionTypeUnordered | CollectionTypeOrdered
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
$# This file is part of Vervis.
|
$# 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.
|
$# ♡ Copying is an act of love. Please copy, reuse and share.
|
||||||
$#
|
$#
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
$# This file is part of Vervis.
|
$# 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.
|
$# ♡ 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}>
|
<a href=@{LoomFollowersR loomHash}>
|
||||||
[🐤 Followers]
|
[🐤 Followers]
|
||||||
<span>
|
<span>
|
||||||
[🤝 Collaborators]
|
<a href=@{LoomCollabsR loomHash}>
|
||||||
|
[🤝 Collaborators]
|
||||||
<span>
|
<span>
|
||||||
<a href=@{LoomClothsR loomHash}>
|
<a href=@{LoomClothsR loomHash}>
|
||||||
[🧩 Merge Requests]
|
[🥂 Merge Requests]
|
||||||
<span>
|
<span>
|
||||||
<a href=@{RepoR $ hashRepo $ loomRepo loom}>
|
<a href=@{RepoR $ hashRepo $ loomRepo loom}>
|
||||||
[🗃 Repository]
|
[🗃 Repository]
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
$# This file is part of Vervis.
|
$# 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>.
|
$# by fr33domlover <fr33domlover@riseup.net>.
|
||||||
$#
|
$#
|
||||||
$# ♡ Copying is an act of love. Please copy, reuse and share.
|
$# ♡ Copying is an act of love. Please copy, reuse and share.
|
||||||
|
@ -46,6 +46,7 @@ $# ^{personNavW user}
|
||||||
<a href=@{RepoFollowersR repo}>
|
<a href=@{RepoFollowersR repo}>
|
||||||
[🐤 Followers]
|
[🐤 Followers]
|
||||||
<span>
|
<span>
|
||||||
|
<a href=@{RepoCollabsR repo}>
|
||||||
[🤝 Collaborators]
|
[🤝 Collaborators]
|
||||||
<span>
|
<span>
|
||||||
<a href=@{RepoCommitsR repo}>
|
<a href=@{RepoCommitsR repo}>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
$# This file is part of Vervis.
|
$# 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>.
|
$# by fr33domlover <fr33domlover@riseup.net>.
|
||||||
$#
|
$#
|
||||||
$# ♡ Copying is an act of love. Please copy, reuse and share.
|
$# ♡ Copying is an act of love. Please copy, reuse and share.
|
||||||
|
@ -46,6 +46,7 @@ $# ^{personNavW user}
|
||||||
<a href=@{RepoFollowersR repo}>
|
<a href=@{RepoFollowersR repo}>
|
||||||
[🐤 Followers]
|
[🐤 Followers]
|
||||||
<span>
|
<span>
|
||||||
|
<a href=@{RepoCollabsR repo}>
|
||||||
[🤝 Collaborators]
|
[🤝 Collaborators]
|
||||||
<span>
|
<span>
|
||||||
<a href=@{RepoCommitsR repo}>
|
<a href=@{RepoCommitsR repo}>
|
||||||
|
|
Loading…
Reference in a new issue