shallow clone
This commit is contained in:
parent
b8e361e03c
commit
5fc9c1c8cd
6 changed files with 47 additions and 85 deletions
|
|
@ -65,24 +65,11 @@ class BubbleTimelineChannel extends Channel {
|
|||
|
||||
if (this.isNoteMutedOrBlocked(note)) return;
|
||||
|
||||
const reactionsToFetch = [];
|
||||
if (this.user && isRenotePacked(note) && !isQuotePacked(note)) {
|
||||
if (note.renote) {
|
||||
reactionsToFetch.push(this.assignMyReaction(note.renote, this.noteEntityService));
|
||||
if (note.renote.reply) {
|
||||
reactionsToFetch.push(this.assignMyReaction(note.renote.reply, this.noteEntityService));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.user && note.reply) {
|
||||
reactionsToFetch.push(this.assignMyReaction(note.reply, this.noteEntityService));
|
||||
}
|
||||
const clonedNote = await this.assignMyReaction(note, this.noteEntityService);
|
||||
|
||||
await Promise.all(reactionsToFetch);
|
||||
this.connection.cacheNote(clonedNote);
|
||||
|
||||
this.connection.cacheNote(note);
|
||||
|
||||
this.send('note', note);
|
||||
this.send('note', clonedNote);
|
||||
}
|
||||
|
||||
@bindThis
|
||||
|
|
|
|||
|
|
@ -60,24 +60,11 @@ class GlobalTimelineChannel extends Channel {
|
|||
|
||||
if (this.isNoteMutedOrBlocked(note)) return;
|
||||
|
||||
const reactionsToFetch = [];
|
||||
if (this.user && isRenotePacked(note) && !isQuotePacked(note)) {
|
||||
if (note.renote) {
|
||||
reactionsToFetch.push(this.assignMyReaction(note.renote, this.noteEntityService));
|
||||
if (note.renote.reply) {
|
||||
reactionsToFetch.push(this.assignMyReaction(note.renote.reply, this.noteEntityService));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.user && note.reply) {
|
||||
reactionsToFetch.push(this.assignMyReaction(note.reply, this.noteEntityService));
|
||||
}
|
||||
const clonedNote = await this.assignMyReaction(note, this.noteEntityService);
|
||||
|
||||
await Promise.all(reactionsToFetch);
|
||||
this.connection.cacheNote(clonedNote);
|
||||
|
||||
this.connection.cacheNote(note);
|
||||
|
||||
this.send('note', note);
|
||||
this.send('note', clonedNote);
|
||||
}
|
||||
|
||||
@bindThis
|
||||
|
|
|
|||
|
|
@ -81,24 +81,11 @@ class HomeTimelineChannel extends Channel {
|
|||
|
||||
if (this.isNoteMutedOrBlocked(note)) return;
|
||||
|
||||
const reactionsToFetch = [];
|
||||
if (this.user && isRenotePacked(note) && !isQuotePacked(note)) {
|
||||
if (note.renote) {
|
||||
reactionsToFetch.push(this.assignMyReaction(note.renote, this.noteEntityService));
|
||||
if (note.renote.reply) {
|
||||
reactionsToFetch.push(this.assignMyReaction(note.renote.reply, this.noteEntityService));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.user && note.reply) {
|
||||
reactionsToFetch.push(this.assignMyReaction(note.reply, this.noteEntityService));
|
||||
}
|
||||
const clonedNote = await this.assignMyReaction(note, this.noteEntityService);
|
||||
|
||||
await Promise.all(reactionsToFetch);
|
||||
this.connection.cacheNote(clonedNote);
|
||||
|
||||
this.connection.cacheNote(note);
|
||||
|
||||
this.send('note', note);
|
||||
this.send('note', clonedNote);
|
||||
}
|
||||
|
||||
@bindThis
|
||||
|
|
|
|||
|
|
@ -98,24 +98,11 @@ class HybridTimelineChannel extends Channel {
|
|||
}
|
||||
}
|
||||
|
||||
const reactionsToFetch = [];
|
||||
if (this.user && isRenotePacked(note) && !isQuotePacked(note)) {
|
||||
if (note.renote) {
|
||||
reactionsToFetch.push(this.assignMyReaction(note.renote, this.noteEntityService));
|
||||
if (note.renote.reply) {
|
||||
reactionsToFetch.push(this.assignMyReaction(note.renote.reply, this.noteEntityService));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.user && note.reply) {
|
||||
reactionsToFetch.push(this.assignMyReaction(note.reply, this.noteEntityService));
|
||||
}
|
||||
const clonedNote = await this.assignMyReaction(note, this.noteEntityService);
|
||||
|
||||
await Promise.all(reactionsToFetch);
|
||||
this.connection.cacheNote(clonedNote);
|
||||
|
||||
this.connection.cacheNote(note);
|
||||
|
||||
this.send('note', note);
|
||||
this.send('note', clonedNote);
|
||||
}
|
||||
|
||||
@bindThis
|
||||
|
|
|
|||
|
|
@ -70,24 +70,11 @@ class LocalTimelineChannel extends Channel {
|
|||
|
||||
if (this.isNoteMutedOrBlocked(note)) return;
|
||||
|
||||
const reactionsToFetch = [];
|
||||
if (this.user && isRenotePacked(note) && !isQuotePacked(note)) {
|
||||
if (note.renote) {
|
||||
reactionsToFetch.push(this.assignMyReaction(note.renote, this.noteEntityService));
|
||||
if (note.renote.reply) {
|
||||
reactionsToFetch.push(this.assignMyReaction(note.renote.reply, this.noteEntityService));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.user && note.reply) {
|
||||
reactionsToFetch.push(this.assignMyReaction(note.reply, this.noteEntityService));
|
||||
}
|
||||
const clonedNote = await this.assignMyReaction(note, this.noteEntityService);
|
||||
|
||||
await Promise.all(reactionsToFetch);
|
||||
this.connection.cacheNote(clonedNote);
|
||||
|
||||
this.connection.cacheNote(note);
|
||||
|
||||
this.send('note', note);
|
||||
this.send('note', clonedNote);
|
||||
}
|
||||
|
||||
@bindThis
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue