mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-02 20:16:04 +01:00
feat: handle receipt of Add activity #12707
This commit is contained in:
@@ -76,6 +76,22 @@ inbox.create = async (req) => {
|
||||
}
|
||||
};
|
||||
|
||||
inbox.add = async (req) => {
|
||||
const { object, target } = req.body;
|
||||
|
||||
// Only react on Adds pertaining to local posts
|
||||
const { type, id: pid } = await activitypub.helpers.resolveLocalId(object);
|
||||
if (type === 'post') {
|
||||
// Check context of OP
|
||||
const tid = await posts.getPostField(pid, 'tid');
|
||||
const context = await topics.getTopicField(tid, 'context');
|
||||
if (context && context === target) {
|
||||
activitypub.helpers.log(`[activitypub/inbox/add] Associating pid ${pid} with new context ${target}`);
|
||||
await posts.setPostField(pid, 'context', target);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
inbox.update = async (req) => {
|
||||
const { actor, object } = req.body;
|
||||
const isPublic = [...(object.to || []), ...(object.cc || [])].includes(activitypub._constants.publicAddress);
|
||||
|
||||
Reference in New Issue
Block a user