turn task into a function
This commit is contained in:
parent
94c3a71e49
commit
64abef8be9
6 changed files with 50 additions and 72 deletions
|
|
@ -10,6 +10,7 @@ import { isRenotePacked, isQuotePacked } from '@/misc/is-renote.js';
|
|||
import type { Packed } from '@/misc/json-schema.js';
|
||||
import type { JsonObject, JsonValue } from '@/misc/json-value.js';
|
||||
import type Connection from './Connection.js';
|
||||
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
||||
|
||||
/**
|
||||
* Stream channel
|
||||
|
|
@ -101,6 +102,14 @@ export default abstract class Channel {
|
|||
public dispose?(): void;
|
||||
|
||||
public onMessage?(type: string, body: JsonValue): void;
|
||||
|
||||
public async assignMyReaction(note: Packed<'Note'>, noteEntityService: NoteEntityService) {
|
||||
if (this.user === undefined) { return; }
|
||||
if (Object.keys(note.reactions).length > 0) {
|
||||
const myReaction = await noteEntityService.populateMyReaction(note, this.user.id);
|
||||
note.myReaction = myReaction;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export type MiChannelService<T extends boolean> = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue