From e5fc1258eeb842b603da03abb70d59b52f63d665 Mon Sep 17 00:00:00 2001 From: me Date: Tue, 17 Dec 2024 10:46:59 +0200 Subject: [PATCH] add collection id --- src/Fedi/Activity.hs | 5 ++++- src/Fedi/Routes.hs | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Fedi/Activity.hs b/src/Fedi/Activity.hs index 6b4ee9c..e36f633 100644 --- a/src/Fedi/Activity.hs +++ b/src/Fedi/Activity.hs @@ -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 diff --git a/src/Fedi/Routes.hs b/src/Fedi/Routes.hs index ed8c546..c791b41 100644 --- a/src/Fedi/Routes.hs +++ b/src/Fedi/Routes.hs @@ -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"