mirror of
https://github.com/misskey-dev/misskey.git
synced 2025-02-06 04:58:02 +09:00
feat(frontend): ソフトミュートで引っかかったものを表示できるように
This commit is contained in:
parent
3c81926f71
commit
6b1cc0c0f2
4
locales/index.d.ts
vendored
4
locales/index.d.ts
vendored
@ -2774,6 +2774,10 @@ export interface Locale extends ILocale {
|
|||||||
* {name}が何かを言いました
|
* {name}が何かを言いました
|
||||||
*/
|
*/
|
||||||
"userSaysSomething": ParameterizedString<"name">;
|
"userSaysSomething": ParameterizedString<"name">;
|
||||||
|
/**
|
||||||
|
* {name}が「{word}」について何かを言いました
|
||||||
|
*/
|
||||||
|
"userSaysSomethingAbout": ParameterizedString<"name" | "word">;
|
||||||
/**
|
/**
|
||||||
* アクティブにする
|
* アクティブにする
|
||||||
*/
|
*/
|
||||||
|
@ -689,6 +689,7 @@ regexpError: "正規表現エラー"
|
|||||||
regexpErrorDescription: "{tab}ワードミュートの{line}行目の正規表現にエラーが発生しました:"
|
regexpErrorDescription: "{tab}ワードミュートの{line}行目の正規表現にエラーが発生しました:"
|
||||||
instanceMute: "サーバーミュート"
|
instanceMute: "サーバーミュート"
|
||||||
userSaysSomething: "{name}が何かを言いました"
|
userSaysSomething: "{name}が何かを言いました"
|
||||||
|
userSaysSomethingAbout: "{name}が「{word}」について何かを言いました"
|
||||||
makeActive: "アクティブにする"
|
makeActive: "アクティブにする"
|
||||||
display: "表示"
|
display: "表示"
|
||||||
copy: "コピー"
|
copy: "コピー"
|
||||||
|
@ -150,12 +150,15 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||||||
</MkA>
|
</MkA>
|
||||||
</template>
|
</template>
|
||||||
</I18n>
|
</I18n>
|
||||||
<I18n v-else :src="i18n.ts.userSaysSomething" tag="small">
|
<I18n v-else :src="i18n.ts.userSaysSomethingAbout" tag="small">
|
||||||
<template #name>
|
<template #name>
|
||||||
<MkA v-user-preview="appearNote.userId" :to="userPage(appearNote.user)">
|
<MkA v-user-preview="appearNote.userId" :to="userPage(appearNote.user)">
|
||||||
<MkUserName :user="appearNote.user"/>
|
<MkUserName :user="appearNote.user"/>
|
||||||
</MkA>
|
</MkA>
|
||||||
</template>
|
</template>
|
||||||
|
<template #word>
|
||||||
|
{{ Array.isArray(muted) ? muted.map(words => Array.isArray(words) ? words.join() : words).join(' ') : muted }}
|
||||||
|
</template>
|
||||||
</I18n>
|
</I18n>
|
||||||
</div>
|
</div>
|
||||||
<div v-else>
|
<div v-else>
|
||||||
@ -210,6 +213,7 @@ import { isEnabledUrlPreview } from '@/instance.js';
|
|||||||
import { type Keymap } from '@/scripts/hotkey.js';
|
import { type Keymap } from '@/scripts/hotkey.js';
|
||||||
import { focusPrev, focusNext } from '@/scripts/focus.js';
|
import { focusPrev, focusNext } from '@/scripts/focus.js';
|
||||||
import { getAppearNote } from '@/scripts/get-appear-note.js';
|
import { getAppearNote } from '@/scripts/get-appear-note.js';
|
||||||
|
import { WorkerMultiDispatch } from '@/scripts/worker-multi-dispatch';
|
||||||
|
|
||||||
const props = withDefaults(defineProps<{
|
const props = withDefaults(defineProps<{
|
||||||
note: Misskey.entities.Note;
|
note: Misskey.entities.Note;
|
||||||
@ -292,12 +296,17 @@ const pleaseLoginContext = computed<OpenOnRemoteOptions>(() => ({
|
|||||||
function checkMute(noteToCheck: Misskey.entities.Note, mutedWords: Array<string | string[]> | undefined | null, checkOnly: true): boolean;
|
function checkMute(noteToCheck: Misskey.entities.Note, mutedWords: Array<string | string[]> | undefined | null, checkOnly: true): boolean;
|
||||||
function checkMute(noteToCheck: Misskey.entities.Note, mutedWords: Array<string | string[]> | undefined | null, checkOnly: false): boolean | 'sensitiveMute';
|
function checkMute(noteToCheck: Misskey.entities.Note, mutedWords: Array<string | string[]> | undefined | null, checkOnly: false): boolean | 'sensitiveMute';
|
||||||
*/
|
*/
|
||||||
function checkMute(noteToCheck: Misskey.entities.Note, mutedWords: Array<string | string[]> | undefined | null, checkOnly = false): boolean | 'sensitiveMute' {
|
function checkMute(noteToCheck: Misskey.entities.Note, mutedWords: Array<string | string[]> | undefined | null, checkOnly = false): Array<string | string[]> | false | 'sensitiveMute' {
|
||||||
if (mutedWords != null) {
|
if (mutedWords == null) return false;
|
||||||
if (checkWordMute(noteToCheck, $i, mutedWords)) return true;
|
|
||||||
if (noteToCheck.reply && checkWordMute(noteToCheck.reply, $i, mutedWords)) return true;
|
const result = checkWordMute(noteToCheck, $i, mutedWords);
|
||||||
if (noteToCheck.renote && checkWordMute(noteToCheck.renote, $i, mutedWords)) return true;
|
if (Array.isArray(result)) return result;
|
||||||
}
|
|
||||||
|
const replyResult = noteToCheck.reply && checkWordMute(noteToCheck.reply, $i, mutedWords);
|
||||||
|
if (Array.isArray(replyResult)) return replyResult;
|
||||||
|
|
||||||
|
const renoteResult = noteToCheck.renote && checkWordMute(noteToCheck.renote, $i, mutedWords);
|
||||||
|
if (Array.isArray(renoteResult)) return renoteResult;
|
||||||
|
|
||||||
if (checkOnly) return false;
|
if (checkOnly) return false;
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
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[]>): boolean {
|
export function checkWordMute(note: 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 && (note.userId === me.id)) return false;
|
||||||
|
|
||||||
@ -13,7 +13,7 @@ export function checkWordMute(note: Misskey.entities.Note, me: Misskey.entities.
|
|||||||
|
|
||||||
if (text === '') return false;
|
if (text === '') return false;
|
||||||
|
|
||||||
const matched = mutedWords.some(filter => {
|
const matched = mutedWords.filter(filter => {
|
||||||
if (Array.isArray(filter)) {
|
if (Array.isArray(filter)) {
|
||||||
// Clean up
|
// Clean up
|
||||||
const filteredFilter = filter.filter(keyword => keyword !== '');
|
const filteredFilter = filter.filter(keyword => keyword !== '');
|
||||||
@ -36,7 +36,7 @@ export function checkWordMute(note: Misskey.entities.Note, me: Misskey.entities.
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (matched) return true;
|
if (matched.length > 0) return matched;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user