Skip to content

Node.js based forum software built for the modern web

feat: fire new hook `filter:activitypub.mocks.note` on note mocking

Julian Lam4ba41a68011c
diff --git a/src/activitypub/mocks.js b/src/activitypub/mocks.js
index 686196aef2..0bcc83fe36 100644
--- a/src/activitypub/mocks.js
+++ b/src/activitypub/mocks.js
@@ -431,7 +431,7 @@ Mocks.notes.public = async (post) => {
let context = await posts.getPostField(post.pid, 'context');
context = context || `${nconf.get('url')}/topic/${post.topic.tid}`;
- const object = {
+ let object = {
'@context': 'https://www.w3.org/ns/activitystreams',
id,
type: 'Note',
@@ -453,6 +453,7 @@ Mocks.notes.public = async (post) => {
replies: `${id}/replies`,
};
+ ({ object } = await plugins.hooks.fire('filter:activitypub.mocks.note', { object, post, private: false }));
return object;
};
@@ -510,7 +511,7 @@ Mocks.notes.private = async ({ messageObj }) => {
}
}
- const object = {
+ let object = {
'@context': 'https://www.w3.org/ns/activitystreams',
id,
type: 'Note',
@@ -532,6 +533,7 @@ Mocks.notes.private = async ({ messageObj }) => {
// replies: `${id}/replies`, // todo
};
+ ({ object } = await plugins.hooks.fire('filter:activitypub.mocks.note', { object, post: messageObj, private: false }));
return object;
};