diff options
| author | Sugar <sugar@sylveon.social> | 2024-05-11 09:44:03 +0200 |
|---|---|---|
| committer | Sugar <sugar@sylveon.social> | 2024-05-11 09:44:03 +0200 |
| commit | 194d8a5527ed98a2f9679e1381a6d7290f10a1b7 (patch) | |
| tree | cec1b5eefa46ffcddf0970edaab39ddbe5634757 /packages | |
| parent | merge: bump develop after 2024.3.3 (!512) (diff) | |
| download | sharkey-194d8a5527ed98a2f9679e1381a6d7290f10a1b7.tar.gz sharkey-194d8a5527ed98a2f9679e1381a6d7290f10a1b7.tar.bz2 sharkey-194d8a5527ed98a2f9679e1381a6d7290f10a1b7.zip | |
feat: send edit events to servers that interacted
a server replied to, renoted or reacted to a note knows about a note,
and as such it should get notified about it being edited.
this matches similar logic in mastodon.
Diffstat (limited to 'packages')
| -rw-r--r-- | packages/backend/src/core/NoteEditService.ts | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/packages/backend/src/core/NoteEditService.ts b/packages/backend/src/core/NoteEditService.ts index a01dfec664..399461dd70 100644 --- a/packages/backend/src/core/NoteEditService.ts +++ b/packages/backend/src/core/NoteEditService.ts @@ -699,6 +699,24 @@ export class NoteEditService implements OnApplicationShutdown { dm.addFollowersRecipe(); } + if (['public', 'home'].includes(note.visibility)) { + // Send edit event to all users who replied to, + // renoted a post or reacted to a note. + const noteId = note.id; + const users = await this.usersRepository.createQueryBuilder() + .where( + 'id IN (SELECT "userId" FROM note WHERE "replyId" = :noteId OR "renoteId" = :noteId UNION SELECT "userId" FROM note_reaction WHERE "noteId" = :noteId)', + { noteId }, + ) + .andWhere('host IS NOT NULL') + .getMany(); + for (const u of users) { + // User was verified to be remote by checking + // whether host IS NOT NULL in SQL query. + dm.addDirectRecipe(u as MiRemoteUser); + } + } + if (['public'].includes(note.visibility)) { this.relayService.deliverToRelays(user, noteActivity); } |