1
0
Fork 0
mirror of https://code.naskya.net/repos/ndqEd synced 2025-03-20 15:14:54 +09:00

Add 'cloneUri' to AP.Repo, publish in getRepoR, grab in offerTicketC

In offerTicketC it can be used for fetching commits from the remote origin
repo, by knowing its clone URI

Only HTTP clone URIs are supported for now, because it's enough for finishing
the federated MR implementation. Apparently user@host:path isn't a valid URI
and I'll later add a parser for that
This commit is contained in:
fr33domlover 2022-09-22 06:02:14 +00:00
parent e7ab9e701c
commit 2e7c5f767c
3 changed files with 27 additions and 17 deletions

View file

@ -463,6 +463,7 @@ data Repo u = Repo
, repoTeam :: Maybe LocalURI
, repoVcs :: VersionControlSystem
, repoLoom :: Maybe LocalURI
, repoClone :: NonEmpty LocalURI
}
instance ActivityPub Repo where
@ -476,11 +477,13 @@ instance ActivityPub Repo where
<$> withAuthorityMaybeO h (o .:|? "team")
<*> o .: "versionControlSystem"
<*> withAuthorityMaybeO h (o .:? "sendPatchesTo")
toSeries authority (Repo actor team vcs loom)
<*> (traverse (withAuthorityO h . pure) =<< o .:*+ "cloneUri")
toSeries authority (Repo actor team vcs loom clone)
= toSeries authority actor
<> "team" .= (ObjURI authority <$> team)
<> "versionControlSystem" .= vcs
<> "sendPatchesTo" .=? (ObjURI authority <$> loom)
<> "cloneUri" .=*+ (ObjURI authority <$> clone)
data TicketTracker u = TicketTracker
{ ticketTrackerActor :: Actor u