refactor: move all methods in src/api/activitypub.js to src/activitypub.out.js

This commit is contained in:
Julian Lam
2025-10-22 12:51:50 -04:00
parent bb34b8c7a3
commit 3ede64d8a1
18 changed files with 364 additions and 451 deletions

View File

@@ -151,7 +151,7 @@ postsAPI.edit = async function (caller, data) {
if (!editResult.post.deleted) {
websockets.in(`topic_${editResult.topic.tid}`).emit('event:post_edited', editResult);
setTimeout(() => {
require('.').activitypub.update.note(caller, { post: postObj[0] });
activitypub.out.update.note(caller.uid, postObj[0]);
}, 5000);
return returnData;
@@ -208,7 +208,7 @@ async function deleteOrRestore(caller, data, params) {
// Explicitly non-awaited
posts.getPostSummaryByPids([data.pid], caller.uid, { extraFields: ['edited'] }).then(([post]) => {
require('.').activitypub.update.note(caller, { post });
activitypub.out.update.note(caller.uid, post);
});
}
@@ -254,7 +254,7 @@ postsAPI.purge = async function (caller, data) {
posts.clearCachedPost(data.pid);
await Promise.all([
posts.purge(data.pid, caller.uid),
require('.').activitypub.delete.note(caller, { pid: data.pid }),
activitypub.out.delete.note(caller.uid, data.pid),
]);
websockets.in(`topic_${postData.tid}`).emit('event:post_purged', postData);