handle Update
activities for Notes
#395
Loading…
Reference in a new issue
No description provided.
Delete branch "note-editing"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This adds handling for
Update
activities whoseobject
is aNote
(aka "editing").The things that can be edited are:
ap:content
)consequently also the contained emoji and hashtags
ap:summary
)ap:url
)ap:name
)Anything else that is sent in the activity is disregarded as updating it is not supported, in particular changing the recipients/addressing information in this way is not supported.
Much cleaner than whatever hacked-up copypastes I could've came up with; I can't attest to it working or not (I don't run an instance and can't tell from the code itself as I'm not familiar enough with the codebase) but I don't have much to say here other than it looks good to me and the refactoring (splitting side-effects etc in a different file for Notes) is pretty important and helps a lot for the cleanliness and clarity of this feature.
@ -169,6 +169,7 @@ export const NoteRepository = db.getRepository(Note).extend({
const packed: Packed<'Note'> = await awaitAll({
id: note.id,
createdAt: note.createdAt.toISOString(),
updatedAt: note.udpatedAt?.toISOString() ?? null,
s/udpatedAt/updatedAt
@ -0,0 +16,4 @@
// and since this is not a direct creation, handle it silently
createNote(resolver, actor, note, true);
const unlock = await getApLock(uri);
I assume this is used to get exclusive ownership of an AP object?
Yes this is also used in the respective AP kernel function for
Create/Note
.I'd assume it's also used for
Delete
s; it does not seem to be used in the alternative path forupdateNote
though, which could be a problem (I assume that is why there was aunlock()
there but no matching definition)@ -0,0 +22,4 @@
const existsNow = await Notes.findOneByOrFail({ uri });
// set the updatedAt timestamp since the note was changed
await Notes.update(existsNow.id, { updatedAt: new Date() });
return 'ok: unkown note created and marked as updated';
s/unkown/unknown
@ -0,0 +43,4 @@
} catch (e) {
return `skip: update note rejected: ${e.message}`;
} finally {
unlock();
unlock
is undefined here, I suggest removing thefinally
blockf0f497c09c
to9665c04ce3
Running this branch on misskey.biribiri.dev right now, doesn't seem like updates are even processed for some reason. The logs don't seem to reveal anything related to update activities.
9665c04ce3
to723eed294c
900f980cc8
to8ec579c894
8ec579c894
to1f542265ee
1f542265ee
toeb91b1e03f
eb91b1e03f
to796adc8599