shallow clone

This commit is contained in:
piuvas 2025-01-08 12:51:46 -03:00
parent b8e361e03c
commit 5fc9c1c8cd
No known key found for this signature in database
GPG key ID: 82743F52454C621D
6 changed files with 47 additions and 85 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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