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

DB: Add media type field to 'Patch' entity

This patch (haha) also adds a VCS field to the AP representation of repos
This commit is contained in:
fr33domlover 2020-08-14 21:16:33 +00:00
parent b16c9505af
commit cb11ea6447
29 changed files with 304 additions and 144 deletions

View file

@ -46,7 +46,6 @@ module Web.ActivityPub
, TicketDependency (..)
, TextHtml (..)
, TextPandocMarkdown (..)
, PatchType (..)
, PatchLocal (..)
, Patch (..)
, BundleLocal (..)
@ -147,6 +146,8 @@ import qualified Network.HTTP.Signature as S
import qualified Text.Email.Parser as E
import Crypto.PublicVerifKey
import Development.PatchMediaType
import Development.PatchMediaType.JSON
import Network.FedURI
import Network.HTTP.Digest
@ -402,10 +403,11 @@ instance ActivityPub Actor where
data Repo u = Repo
{ repoActor :: Actor u
, repoTeam :: LocalURI
, repoVcs :: VersionControlSystem
}
instance ActivityPub Repo where
jsonldContext _ = [as2Context, secContext, forgeContext, extContext]
jsonldContext _ = [as2Context, secContext, forgeContext]
parseObject o = do
(h, a) <- parseObject o
unless (actorType a == ActorTypeRepo) $
@ -413,9 +415,11 @@ instance ActivityPub Repo where
fmap (h,) $
Repo a
<$> withAuthorityO h (o .:| "team")
toSeries authority (Repo actor team)
<*> o .: "versionControlSystem"
toSeries authority (Repo actor team vcs)
= toSeries authority actor
<> "team" .= ObjURI authority team
<> "team" .= ObjURI authority team
<> "versionControlSystem" .= vcs
data Project u = Project
{ projectActor :: Actor u
@ -875,7 +879,7 @@ data Patch u = Patch
{ patchLocal :: Maybe (Authority u, PatchLocal)
, patchAttributedTo :: LocalURI
, patchPublished :: Maybe UTCTime
, patchType :: PatchType
, patchType :: PatchMediaType
, patchContent :: Text
}