allow checkWordMute to accept raw strings

This commit is contained in:
Hazelnoot 2025-05-10 22:32:06 -04:00
parent 4dc82cad62
commit 9dbdb97bb5

View file

@ -4,12 +4,12 @@
*/ */
import * as Misskey from 'misskey-js'; import * as Misskey from 'misskey-js';
export function checkWordMute(note: Misskey.entities.Note, me: Misskey.entities.UserLite | null | undefined, mutedWords: Array<string | string[]>): Array<string | string[]> | false { export function checkWordMute(note: string | Misskey.entities.Note, me: Misskey.entities.UserLite | null | undefined, mutedWords: Array<string | string[]>): Array<string | string[]> | false {
// 自分自身 // 自分自身
if (me && (note.userId === me.id)) return false; if (me && typeof(note) === 'object' && (note.userId === me.id)) return false;
if (mutedWords.length > 0) { if (mutedWords.length > 0) {
const text = getNoteText(note); const text = typeof(note) === 'object' ? getNoteText(note) : note;
if (text === '') return false; if (text === '') return false;