summaryrefslogtreecommitdiff
path: root/packages/backend/src/core/NoteEditService.ts
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2024-05-31 11:24:00 +0100
committerdakkar <dakkar@thenautilus.net>2024-05-31 11:24:00 +0100
commit4ddee7b01e9a45e9f17f210ebe361b00e919073c (patch)
tree54658e54859295fb4dc71fa8435643731b6e53f6 /packages/backend/src/core/NoteEditService.ts
parentfix: event propagation for reactions button in MkNote (diff)
parentmerge: feat: send edit events to servers that interacted (!515) (diff)
downloadsharkey-4ddee7b01e9a45e9f17f210ebe361b00e919073c.tar.gz
sharkey-4ddee7b01e9a45e9f17f210ebe361b00e919073c.tar.bz2
sharkey-4ddee7b01e9a45e9f17f210ebe361b00e919073c.zip
Merge branch 'develop' into future
Diffstat (limited to 'packages/backend/src/core/NoteEditService.ts')
-rw-r--r--packages/backend/src/core/NoteEditService.ts18
1 files changed, 18 insertions, 0 deletions
diff --git a/packages/backend/src/core/NoteEditService.ts b/packages/backend/src/core/NoteEditService.ts
index 34017f015a..244f7e78d4 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);
}