mirror of
https://activitypub.software/TransFem-org/Sharkey
synced 2024-11-24 23:15:13 +00:00
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>
This commit is contained in:
commit
9bde071f42
1 changed files with 18 additions and 0 deletions
|
@ -699,6 +699,24 @@ export class NoteEditService implements OnApplicationShutdown {
|
||||||
dm.addFollowersRecipe();
|
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)) {
|
if (['public'].includes(note.visibility)) {
|
||||||
this.relayService.deliverToRelays(user, noteActivity);
|
this.relayService.deliverToRelays(user, noteActivity);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue