Skip to content

Node.js based forum software built for the modern web

fix: unable to process Update(Person)

Julian Lam96a3a7465fb6
diff --git a/src/activitypub/inbox.js b/src/activitypub/inbox.js
index 76c322fd1c..6ea6e12f41 100644
--- a/src/activitypub/inbox.js
+++ b/src/activitypub/inbox.js
@@ -38,20 +38,20 @@ inbox.update = async (req) => {
throw new Error('[[error:activitypub.origin-mismatch]]');
}
- const [exists, allowed] = await Promise.all([
- posts.exists(object.id),
- privileges.posts.can('posts:edit', object.id, activitypub._constants.uid),
- ]);
- if (!exists || !allowed) {
- winston.info(`[activitypub/inbox.update] ${object.id} not allowed to be edited.`);
- return activitypub.send('uid', 0, actor, {
- type: 'Reject',
- object,
- });
- }
-
switch (object.type) {
case 'Note': {
+ const [exists, allowed] = await Promise.all([
+ posts.exists(object.id),
+ privileges.posts.can('posts:edit', object.id, activitypub._constants.uid),
+ ]);
+ if (!exists || !allowed) {
+ winston.info(`[activitypub/inbox.update] ${object.id} not allowed to be edited.`);
+ return activitypub.send('uid', 0, actor, {
+ type: 'Reject',
+ object,
+ });
+ }
+
const postData = await activitypub.mocks.post(object);
if (postData) {