mirror of
https://codeberg.org/yeentown/barkey.git
synced 2025-04-28 01:26:58 +00:00
use assignMyReaction in channel, hashtag, role-timeline, and user-list channels
This commit is contained in:
parent
019e60d9a4
commit
30b2bfb184
4 changed files with 14 additions and 27 deletions
|
@ -7,7 +7,6 @@ import { Injectable } from '@nestjs/common';
|
|||
import type { Packed } from '@/misc/json-schema.js';
|
||||
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
import { isRenotePacked, isQuotePacked } from '@/misc/is-renote.js';
|
||||
import type { JsonObject } from '@/misc/json-value.js';
|
||||
import Channel, { type MiChannelService } from '../channel.js';
|
||||
|
||||
|
@ -50,16 +49,11 @@ class ChannelChannel extends Channel {
|
|||
|
||||
if (this.isNoteMutedOrBlocked(note)) return;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
const clonedNote = await this.assignMyReaction(note);
|
||||
|
||||
this.connection.cacheNote(note);
|
||||
this.connection.cacheNote(clonedNote);
|
||||
|
||||
this.send('note', note);
|
||||
this.send('note', clonedNote);
|
||||
}
|
||||
|
||||
@bindThis
|
||||
|
|
|
@ -8,7 +8,6 @@ import { normalizeForSearch } from '@/misc/normalize-for-search.js';
|
|||
import type { Packed } from '@/misc/json-schema.js';
|
||||
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
import { isRenotePacked, isQuotePacked } from '@/misc/is-renote.js';
|
||||
import type { JsonObject } from '@/misc/json-value.js';
|
||||
import Channel, { type MiChannelService } from '../channel.js';
|
||||
|
||||
|
@ -46,16 +45,11 @@ class HashtagChannel extends Channel {
|
|||
|
||||
if (this.isNoteMutedOrBlocked(note)) return;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
const clonedNote = await this.assignMyReaction(note);
|
||||
|
||||
this.connection.cacheNote(note);
|
||||
this.connection.cacheNote(clonedNote);
|
||||
|
||||
this.send('note', note);
|
||||
this.send('note', clonedNote);
|
||||
}
|
||||
|
||||
@bindThis
|
||||
|
|
|
@ -48,7 +48,11 @@ class RoleTimelineChannel extends Channel {
|
|||
|
||||
if (this.isNoteMutedOrBlocked(note)) return;
|
||||
|
||||
this.send('note', note);
|
||||
const clonedNote = await this.assignMyReaction(note);
|
||||
|
||||
this.connection.cacheNote(clonedNote);
|
||||
|
||||
this.send('note', clonedNote);
|
||||
} else {
|
||||
this.send(data.type, data.body);
|
||||
}
|
||||
|
|
|
@ -111,16 +111,11 @@ class UserListChannel extends Channel {
|
|||
|
||||
if (this.isNoteMutedOrBlocked(note)) return;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
const clonedNote = await this.assignMyReaction(note);
|
||||
|
||||
this.connection.cacheNote(note);
|
||||
this.connection.cacheNote(clonedNote);
|
||||
|
||||
this.send('note', note);
|
||||
this.send('note', clonedNote);
|
||||
}
|
||||
|
||||
@bindThis
|
||||
|
|
Loading…
Add table
Reference in a new issue