add collection id

This commit is contained in:
me 2024-12-17 10:46:59 +02:00
parent 17e41b10b8
commit e5fc1258ee
2 changed files with 6 additions and 2 deletions

View file

@ -58,7 +58,8 @@ data OrderedCollectionPage a
data Collection order a
= Collection
{ summary :: String
{ id :: Url
, summary :: String
, items :: [a]
, first :: Maybe Url
, last :: Maybe Url
@ -101,6 +102,7 @@ instance A.ToJSON a => A.ToJSON (Collection Ordered a) where
[ "@context" A..=
[ "https://www.w3.org/ns/activitystreams" :: String
]
, "id" A..= collection.id
, "type" A..= ("OrderedCollection" :: String)
, "summary" A..= collection.summary
, "totalItems" A..= length collection.items
@ -115,6 +117,7 @@ instance A.ToJSON a => A.ToJSON (Collection Unordered a) where
[ "@context" A..=
[ "https://www.w3.org/ns/activitystreams" :: String
]
, "id" A..= collection.id
, "type" A..= ("Collection" :: String)
, "summary" A..= collection.summary
, "totalItems" A..= length collection.items

View file

@ -139,7 +139,8 @@ handleOutbox details items = do
content :: Outbox
content =
Collection
{ summary = details.username <> "'s notes"
{ id = outboxUrl
, summary = details.username <> "'s notes"
, items = items
, first = Just $ outboxUrl <> "?page=true"
, last = Just $ outboxUrl <> "?page=true"