mirror of
https://code.naskya.net/repos/ndqEd
synced 2025-03-20 15:14:54 +09:00
C2S, UI: Loom creation and Repo linking to a Loom
RepoSourceR, for a repo that doesn't have a loom, lists looms that want to serve that repo with buttons for bidirectionally linking the repo to a loom Once linked, the repo navbar has a Patches/MRs link pointing to the LoomClothsR of the linked Loom
This commit is contained in:
parent
1c8c6d9d24
commit
c495d78d05
15 changed files with 598 additions and 27 deletions
src/Web
|
@ -462,6 +462,7 @@ data Repo u = Repo
|
|||
{ repoActor :: Actor u
|
||||
, repoTeam :: Maybe LocalURI
|
||||
, repoVcs :: VersionControlSystem
|
||||
, repoLoom :: Maybe LocalURI
|
||||
}
|
||||
|
||||
instance ActivityPub Repo where
|
||||
|
@ -474,10 +475,12 @@ instance ActivityPub Repo where
|
|||
Repo a
|
||||
<$> withAuthorityMaybeO h (o .:|? "team")
|
||||
<*> o .: "versionControlSystem"
|
||||
toSeries authority (Repo actor team vcs)
|
||||
<*> withAuthorityMaybeO h (o .:? "sendPatchesTo")
|
||||
toSeries authority (Repo actor team vcs loom)
|
||||
= toSeries authority actor
|
||||
<> "team" .= (ObjURI authority <$> team)
|
||||
<> "versionControlSystem" .= vcs
|
||||
<> "sendPatchesTo" .=? (ObjURI authority <$> loom)
|
||||
|
||||
data TicketTracker u = TicketTracker
|
||||
{ ticketTrackerActor :: Actor u
|
||||
|
@ -1441,6 +1444,7 @@ data CreateObject u
|
|||
| CreateTicket (Authority u) (Ticket u)
|
||||
| CreateTicketTracker ActorDetail (Maybe (Authority u, ActorLocal u))
|
||||
| CreateRepository ActorDetail VersionControlSystem (Maybe (Authority u, ActorLocal u))
|
||||
| CreatePatchTracker ActorDetail (NonEmpty (ObjURI u)) (Maybe (Authority u, ActorLocal u))
|
||||
|
||||
parseCreateObject :: UriMode u => Object -> Parser (CreateObject u)
|
||||
parseCreateObject o
|
||||
|
@ -1457,6 +1461,12 @@ parseCreateObject o
|
|||
vcs <- o .: "versionControlSystem"
|
||||
ml <- parseActorLocal o
|
||||
return $ CreateRepository d vcs ml
|
||||
<|> do d <- parseActorDetail o
|
||||
unless (actorType d == ActorTypePatchTracker) $
|
||||
fail "type isn't PatchTracker"
|
||||
repos <- o .:*+ "tracksPatchesFor"
|
||||
ml <- parseActorLocal o
|
||||
return $ CreatePatchTracker d repos ml
|
||||
|
||||
encodeCreateObject :: UriMode u => CreateObject u -> Series
|
||||
encodeCreateObject (CreateNote h note) = toSeries h note
|
||||
|
@ -1467,6 +1477,10 @@ encodeCreateObject (CreateRepository d vcs ml)
|
|||
= encodeActorDetail d
|
||||
<> "versionControlSystem" .= vcs
|
||||
<> maybe mempty (uncurry encodeActorLocal) ml
|
||||
encodeCreateObject (CreatePatchTracker d repos ml)
|
||||
= encodeActorDetail d
|
||||
<> "tracksPatchesFor" .=*+ repos
|
||||
<> maybe mempty (uncurry encodeActorLocal) ml
|
||||
|
||||
data Create u = Create
|
||||
{ createObject :: CreateObject u
|
||||
|
@ -1485,6 +1499,7 @@ parseCreate o a luActor = do
|
|||
fail "Create actor != note attrib"
|
||||
CreateTicketTracker _ _ -> return ()
|
||||
CreateRepository _ _ _ -> return ()
|
||||
CreatePatchTracker _ _ _ -> return ()
|
||||
Create obj <$> o .:? "target"
|
||||
|
||||
encodeCreate :: UriMode u => Create u -> Series
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue