mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-30 10:35:55 +01:00
fix: handle undo(Announce) of remote notes
This commit is contained in:
@@ -229,9 +229,9 @@ inbox.undo = async (req) => {
|
|||||||
throw new Error('[[error:activitypub.invalid-id]]');
|
throw new Error('[[error:activitypub.invalid-id]]');
|
||||||
}
|
}
|
||||||
|
|
||||||
const { type: localType, id } = await helpers.resolveLocalId(object.object);
|
let { type: localType, id } = await helpers.resolveLocalId(object.object);
|
||||||
|
|
||||||
winston.info(`[activitypub/inbox/undo] ${type} ${localType} ${id} via ${actor}`);
|
winston.info(`[activitypub/inbox/undo] ${type} ${localType && id ? `${localType} ${id}` : object.object} via ${actor}`);
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 'Follow': {
|
case 'Follow': {
|
||||||
@@ -273,9 +273,10 @@ inbox.undo = async (req) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
case 'Announce': {
|
case 'Announce': {
|
||||||
|
id = id || object.object; // remote announces
|
||||||
const exists = await posts.exists(id);
|
const exists = await posts.exists(id);
|
||||||
if (localType !== 'post' || !exists) {
|
if (!exists) {
|
||||||
throw new Error('[[error:invalid-pid]]');
|
winston.verbose(`[activitypub/inbox/undo] Attempted to undo announce of ${id} but couldn't find it, so doing nothing.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const tid = await posts.getPostField(id, 'tid');
|
const tid = await posts.getPostField(id, 'tid');
|
||||||
|
|||||||
Reference in New Issue
Block a user