This commit is contained in:
tamaina 2021-09-12 01:36:47 +09:00
parent 4bd42cf071
commit 217bf12aab
1 changed files with 4 additions and 7 deletions

View File

@ -3,6 +3,7 @@ import Channel from '../channel';
import { Notes } from '@/models/index'; import { Notes } from '@/models/index';
import { isMutedUserRelated } from '@/misc/is-muted-user-related'; import { isMutedUserRelated } from '@/misc/is-muted-user-related';
import { isBlockerUserRelated } from '@/misc/is-blocker-user-related'; import { isBlockerUserRelated } from '@/misc/is-blocker-user-related';
import { StreamMessages } from '../types';
export default class extends Channel { export default class extends Channel {
public readonly chName = 'antenna'; public readonly chName = 'antenna';
@ -19,11 +20,9 @@ export default class extends Channel {
} }
@autobind @autobind
private async onEvent(data: any) { private async onEvent(data: StreamMessages['antenna']['spec']) {
const { type, body } = data; if (data.type === 'note') {
const note = await Notes.pack(data.body.id, this.user, { detail: true });
if (type === 'note') {
const note = await Notes.pack(body.id, this.user, { detail: true });
// 流れてきたNoteがミュートしているユーザーが関わるものだったら無視する // 流れてきたNoteがミュートしているユーザーが関わるものだったら無視する
if (isMutedUserRelated(note, this.muting)) return; if (isMutedUserRelated(note, this.muting)) return;
@ -33,8 +32,6 @@ export default class extends Channel {
this.connection.cacheNote(note); this.connection.cacheNote(note);
this.send('note', note); this.send('note', note);
} else {
this.send(type, body);
} }
} }