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

For latest-version patches, provide a 'previousVersions' list

This commit is contained in:
fr33domlover 2020-07-14 08:50:57 +00:00
parent a06d273107
commit fa3348513a
2 changed files with 34 additions and 20 deletions

View file

@ -845,6 +845,7 @@ data Patch u = Patch
, patchContext :: LocalURI
, patchType :: PatchType
, patchContent :: Text
, patchPrevVersions :: [LocalURI]
}
instance ActivityPub Patch where
@ -864,15 +865,17 @@ instance ActivityPub Patch where
<*> withAuthorityO a (o .: "context")
<*> o .: "mediaType"
<*> o .: "content"
<*> (traverse (withAuthorityO a . return) =<< o .:? "previousVersions" .!= [])
toSeries a (Patch id_ attrib published context typ content)
= "id" .= ObjURI a id_
<> "type" .= ("Patch" :: Text)
<> "attributedTo" .= attrib
<> "context" .= ObjURI a context
<> "published" .= published
<> "mediaType" .= typ
<> "content" .= content
toSeries a (Patch id_ attrib published context typ content vers)
= "id" .= ObjURI a id_
<> "type" .= ("Patch" :: Text)
<> "attributedTo" .= attrib
<> "context" .= ObjURI a context
<> "published" .= published
<> "mediaType" .= typ
<> "content" .= content
<> "previousVersions" .= map (ObjURI a) vers
data TicketLocal = TicketLocal
{ ticketId :: LocalURI