diff options
| author | Marie <marie@kaifa.ch> | 2024-05-30 19:16:10 +0000 |
|---|---|---|
| committer | Marie <marie@kaifa.ch> | 2024-05-30 19:16:10 +0000 |
| commit | 9bde071f42b2bc2500f65f8cf4fd4f52464cf00b (patch) | |
| tree | d155c515e54b6eae82fd80cd60b181555eedaf62 | |
| parent | merge: fix(i18n): adjust grammar in about_misskey (!523) (diff) | |
| parent | feat: send edit events to servers that interacted (diff) | |
| download | sharkey-9bde071f42b2bc2500f65f8cf4fd4f52464cf00b.tar.gz sharkey-9bde071f42b2bc2500f65f8cf4fd4f52464cf00b.tar.bz2 sharkey-9bde071f42b2bc2500f65f8cf4fd4f52464cf00b.zip | |
merge: feat: send edit events to servers that interacted (!515)
View MR for information: https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/515
Approved-by: dakkar <dakkar@thenautilus.net>
Approved-by: Marie <marie@kaifa.ch>
Approved-by: Leah <kevinlukej@gmail.com>
Approved-by: Amelia Yukii <amelia.yukii@shourai.de>
| -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); } |