mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-12-16 13:30:23 +01:00
feat: if Update(Note) is received for a post that does not already exist, assert it
This commit is contained in:
@@ -43,8 +43,13 @@ inbox.update = async (req) => {
|
||||
switch (object.type) {
|
||||
case 'Note': {
|
||||
const postData = await activitypub.mocks.post(object);
|
||||
const exists = await posts.exists(object.id);
|
||||
try {
|
||||
await posts.edit(postData);
|
||||
if (exists) {
|
||||
await posts.edit(postData);
|
||||
} else {
|
||||
await activitypub.notes.assertTopic(0, object.id);
|
||||
}
|
||||
} catch (e) {
|
||||
activitypub.send('uid', 0, actor, {
|
||||
type: 'Reject',
|
||||
|
||||
Reference in New Issue
Block a user