feat: if Update(Note) is received for a post that does not already exist, assert it

This commit is contained in:
Julian Lam
2024-03-13 15:05:42 -04:00
parent c5c0c47393
commit 0bfdbb6a5c

View File

@@ -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',