mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-24 00:39:32 +09:00
perf(backend): reduce needless populateMyReaction calls
This commit is contained in:
parent
de6e15e36d
commit
fcc4864080
@ -357,7 +357,7 @@ export class NoteEntityService implements OnModuleInit {
|
|||||||
|
|
||||||
poll: note.hasPoll ? this.populatePoll(note, meId) : undefined,
|
poll: note.hasPoll ? this.populatePoll(note, meId) : undefined,
|
||||||
|
|
||||||
...(meId ? {
|
...(meId && Object.keys(note.reactions).length > 0 ? {
|
||||||
myReaction: this.populateMyReaction(note.id, meId, options?._hint_),
|
myReaction: this.populateMyReaction(note.id, meId, options?._hint_),
|
||||||
} : {}),
|
} : {}),
|
||||||
} : {}),
|
} : {}),
|
||||||
|
@ -46,8 +46,10 @@ class ChannelChannel extends Channel {
|
|||||||
if (note.renote && !note.text && isUserRelated(note, this.userIdsWhoMeMutingRenotes)) return;
|
if (note.renote && !note.text && isUserRelated(note, this.userIdsWhoMeMutingRenotes)) return;
|
||||||
|
|
||||||
if (this.user && note.renoteId && !note.text) {
|
if (this.user && note.renoteId && !note.text) {
|
||||||
const myRenoteReaction = await this.noteEntityService.populateMyReaction(note.renoteId, this.user.id);
|
if (note.renote && Object.keys(note.renote.reactions).length > 0) {
|
||||||
note.renote!.myReaction = myRenoteReaction;
|
const myRenoteReaction = await this.noteEntityService.populateMyReaction(note.renoteId, this.user.id);
|
||||||
|
note.renote!.myReaction = myRenoteReaction;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.connection.cacheNote(note);
|
this.connection.cacheNote(note);
|
||||||
|
@ -72,8 +72,10 @@ class GlobalTimelineChannel extends Channel {
|
|||||||
if (note.renote && !note.text && isUserRelated(note, this.userIdsWhoMeMutingRenotes)) return;
|
if (note.renote && !note.text && isUserRelated(note, this.userIdsWhoMeMutingRenotes)) return;
|
||||||
|
|
||||||
if (this.user && note.renoteId && !note.text) {
|
if (this.user && note.renoteId && !note.text) {
|
||||||
const myRenoteReaction = await this.noteEntityService.populateMyReaction(note.renoteId, this.user.id);
|
if (note.renote && Object.keys(note.renote.reactions).length > 0) {
|
||||||
note.renote!.myReaction = myRenoteReaction;
|
const myRenoteReaction = await this.noteEntityService.populateMyReaction(note.renoteId, this.user.id);
|
||||||
|
note.renote!.myReaction = myRenoteReaction;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.connection.cacheNote(note);
|
this.connection.cacheNote(note);
|
||||||
|
@ -51,8 +51,10 @@ class HashtagChannel extends Channel {
|
|||||||
if (note.renote && !note.text && isUserRelated(note, this.userIdsWhoMeMutingRenotes)) return;
|
if (note.renote && !note.text && isUserRelated(note, this.userIdsWhoMeMutingRenotes)) return;
|
||||||
|
|
||||||
if (this.user && note.renoteId && !note.text) {
|
if (this.user && note.renoteId && !note.text) {
|
||||||
const myRenoteReaction = await this.noteEntityService.populateMyReaction(note.renoteId, this.user.id);
|
if (note.renote && Object.keys(note.renote.reactions).length > 0) {
|
||||||
note.renote!.myReaction = myRenoteReaction;
|
const myRenoteReaction = await this.noteEntityService.populateMyReaction(note.renoteId, this.user.id);
|
||||||
|
note.renote!.myReaction = myRenoteReaction;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.connection.cacheNote(note);
|
this.connection.cacheNote(note);
|
||||||
|
@ -74,8 +74,10 @@ class HomeTimelineChannel extends Channel {
|
|||||||
if (note.renote && !note.text && isUserRelated(note, this.userIdsWhoMeMutingRenotes)) return;
|
if (note.renote && !note.text && isUserRelated(note, this.userIdsWhoMeMutingRenotes)) return;
|
||||||
|
|
||||||
if (this.user && note.renoteId && !note.text) {
|
if (this.user && note.renoteId && !note.text) {
|
||||||
const myRenoteReaction = await this.noteEntityService.populateMyReaction(note.renoteId, this.user.id);
|
if (note.renote && Object.keys(note.renote.reactions).length > 0) {
|
||||||
note.renote!.myReaction = myRenoteReaction;
|
const myRenoteReaction = await this.noteEntityService.populateMyReaction(note.renoteId, this.user.id);
|
||||||
|
note.renote!.myReaction = myRenoteReaction;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.connection.cacheNote(note);
|
this.connection.cacheNote(note);
|
||||||
|
@ -88,8 +88,10 @@ class HybridTimelineChannel extends Channel {
|
|||||||
if (note.renote && !note.text && isUserRelated(note, this.userIdsWhoMeMutingRenotes)) return;
|
if (note.renote && !note.text && isUserRelated(note, this.userIdsWhoMeMutingRenotes)) return;
|
||||||
|
|
||||||
if (this.user && note.renoteId && !note.text) {
|
if (this.user && note.renoteId && !note.text) {
|
||||||
const myRenoteReaction = await this.noteEntityService.populateMyReaction(note.renoteId, this.user.id);
|
if (note.renote && Object.keys(note.renote.reactions).length > 0) {
|
||||||
note.renote!.myReaction = myRenoteReaction;
|
const myRenoteReaction = await this.noteEntityService.populateMyReaction(note.renoteId, this.user.id);
|
||||||
|
note.renote!.myReaction = myRenoteReaction;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.connection.cacheNote(note);
|
this.connection.cacheNote(note);
|
||||||
|
@ -71,8 +71,10 @@ class LocalTimelineChannel extends Channel {
|
|||||||
if (note.renote && !note.text && isUserRelated(note, this.userIdsWhoMeMutingRenotes)) return;
|
if (note.renote && !note.text && isUserRelated(note, this.userIdsWhoMeMutingRenotes)) return;
|
||||||
|
|
||||||
if (this.user && note.renoteId && !note.text) {
|
if (this.user && note.renoteId && !note.text) {
|
||||||
const myRenoteReaction = await this.noteEntityService.populateMyReaction(note.renoteId, this.user.id);
|
if (note.renote && Object.keys(note.renote.reactions).length > 0) {
|
||||||
note.renote!.myReaction = myRenoteReaction;
|
const myRenoteReaction = await this.noteEntityService.populateMyReaction(note.renoteId, this.user.id);
|
||||||
|
note.renote!.myReaction = myRenoteReaction;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.connection.cacheNote(note);
|
this.connection.cacheNote(note);
|
||||||
|
@ -103,8 +103,10 @@ class UserListChannel extends Channel {
|
|||||||
if (note.renote && !note.text && isUserRelated(note, this.userIdsWhoMeMutingRenotes)) return;
|
if (note.renote && !note.text && isUserRelated(note, this.userIdsWhoMeMutingRenotes)) return;
|
||||||
|
|
||||||
if (this.user && note.renoteId && !note.text) {
|
if (this.user && note.renoteId && !note.text) {
|
||||||
const myRenoteReaction = await this.noteEntityService.populateMyReaction(note.renoteId, this.user.id);
|
if (note.renote && Object.keys(note.renote.reactions).length > 0) {
|
||||||
note.renote!.myReaction = myRenoteReaction;
|
const myRenoteReaction = await this.noteEntityService.populateMyReaction(note.renoteId, this.user.id);
|
||||||
|
note.renote!.myReaction = myRenoteReaction;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.connection.cacheNote(note);
|
this.connection.cacheNote(note);
|
||||||
|
Loading…
Reference in New Issue
Block a user