perf(backend): reduce needless populateMyReaction calls

This commit is contained in:
syuilo 2023-10-19 07:56:25 +09:00
parent de6e15e36d
commit fcc4864080
8 changed files with 29 additions and 15 deletions

View file

@ -46,8 +46,10 @@ class ChannelChannel extends Channel {
if (note.renote && !note.text && isUserRelated(note, this.userIdsWhoMeMutingRenotes)) return;
if (this.user && note.renoteId && !note.text) {
const myRenoteReaction = await this.noteEntityService.populateMyReaction(note.renoteId, this.user.id);
note.renote!.myReaction = myRenoteReaction;
if (note.renote && Object.keys(note.renote.reactions).length > 0) {
const myRenoteReaction = await this.noteEntityService.populateMyReaction(note.renoteId, this.user.id);
note.renote!.myReaction = myRenoteReaction;
}
}
this.connection.cacheNote(note);