turn task into a function
This commit is contained in:
@@ -60,25 +60,19 @@ class GlobalTimelineChannel extends Channel {
|
||||
|
||||
if (this.isNoteMutedOrBlocked(note)) return;
|
||||
|
||||
const reactionsToFetch = [];
|
||||
if (this.user && isRenotePacked(note) && !isQuotePacked(note)) {
|
||||
if (note.renote && Object.keys(note.renote.reactions).length > 0) {
|
||||
const myRenoteReaction = await this.noteEntityService.populateMyReaction(note.renote, this.user.id);
|
||||
note.renote.myReaction = myRenoteReaction;
|
||||
}
|
||||
if (note.renote && note.renote.reply) {
|
||||
if (Object.keys(note.renote.reply.reactions).length > 0) {
|
||||
const myReplyReaction = await this.noteEntityService.populateMyReaction(note.renote.reply, this.user.id);
|
||||
note.renote.reply.myReaction = myReplyReaction;
|
||||
if (note.renote) {
|
||||
reactionsToFetch.push(this.assignMyReaction(note.renote, this.noteEntityService));
|
||||
if (note.renote.reply) {
|
||||
reactionsToFetch.push(this.assignMyReaction(note.renote.reply, this.noteEntityService));
|
||||
}
|
||||
}
|
||||
} else if (this.user && note.reply) {
|
||||
reactionsToFetch.push(this.assignMyReaction(note.reply, this.noteEntityService));
|
||||
}
|
||||
|
||||
if (this.user && note.reply) {
|
||||
if (Object.keys(note.reply.reactions).length > 0) {
|
||||
const myReplyReaction = await this.noteEntityService.populateMyReaction(note.reply, this.user.id);
|
||||
note.reply.myReaction = myReplyReaction;
|
||||
}
|
||||
}
|
||||
await Promise.all(reactionsToFetch);
|
||||
|
||||
this.connection.cacheNote(note);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user