feat: serve Tombstone objects for soft deleted posts

re: #12551
This commit is contained in:
Julian Lam
2024-05-07 12:15:51 -04:00
parent 0c0f01b560
commit 5e9d47a1d8
2 changed files with 56 additions and 1 deletions

View File

@@ -212,6 +212,18 @@ Mocks.actors.category = async (cid) => {
Mocks.note = async (post) => {
const id = `${nconf.get('url')}/post/${post.pid}`;
// Return a tombstone for a deleted post
if (post.deleted === true) {
return Mocks.tombstone({
id,
formerType: 'Note',
attributedTo: `${nconf.get('url')}/uid/${post.user.uid}`,
context: `${nconf.get('url')}/topic/${post.topic.tid}`,
audience: `${nconf.get('url')}/category/${post.category.cid}`,
});
}
const published = new Date(parseInt(post.timestamp, 10)).toISOString();
// todo: post visibility
@@ -341,3 +353,9 @@ Mocks.note = async (post) => {
return object;
};
Mocks.tombstone = async properties => ({
'@context': 'https://www.w3.org/ns/activitystreams',
type: 'Tombstone',
...properties,
});