Skip to content

Commit

Permalink
Merge pull request #154 from anatawa12/fix-sensitive-auto-cw
Browse files Browse the repository at this point in the history
fix: センシティブチャンネルの投稿がセンシティブなファイルを含む投稿扱いされる
  • Loading branch information
anatawa12 authored Feb 21, 2024
2 parents b2a9f70 + 5a04b72 commit 43dd672
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
-

### Client
-
- Fix: センシティブチャンネルの投稿がセンシティブなファイルを含む投稿扱いされる問題を修正

### Server
- Fix: 禁止ワード設定によってリモートの投稿がブロックされると、InboxキューにDelayed Jobとして残ってしまう問題を修正
Expand Down
4 changes: 4 additions & 0 deletions locales/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4896,6 +4896,10 @@ export interface Locale extends ILocale {
* {name}のセンシティブなファイルを含む投稿
*/
"userSaysSomethingSensitive": ParameterizedString<"name">;
/**
* {name}のセンシティブチャンネルの投稿
*/
"userSaysSomethingInSensitiveChannel": ParameterizedString<"name">;
/**
* スワイプしてタブを切り替える
*/
Expand Down
1 change: 1 addition & 0 deletions locales/ja-JP.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1220,6 +1220,7 @@ backToTitle: "タイトルへ"
hemisphere: "お住まいの地域"
withSensitive: "センシティブなファイルを含むノートを表示"
userSaysSomethingSensitive: "{name}のセンシティブなファイルを含む投稿"
userSaysSomethingInSensitiveChannel: "{name}のセンシティブチャンネルでの投稿"
enableHorizontalSwipe: "スワイプしてタブを切り替える"

_bubbleGame:
Expand Down
13 changes: 10 additions & 3 deletions packages/frontend/src/components/MkNote.vue
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,13 @@ SPDX-License-Identifier: AGPL-3.0-only
</MkA>
</template>
</I18n>
<I18n v-if="muted === 'sensitiveChannel'" :src="i18n.ts.userSaysSomethingInSensitiveChannel" tag="small">
<template #name>
<MkA v-user-preview="appearNote.userId" :to="userPage(appearNote.user)">
<MkUserName :user="appearNote.user"/>
</MkA>
</template>
</I18n>
<I18n v-else :src="i18n.ts.userSaysSomething" tag="small">
<template #name>
<MkA v-user-preview="appearNote.userId" :to="userPage(appearNote.user)">
Expand Down Expand Up @@ -273,9 +280,9 @@ const renoteCollapsed = ref(

/* Overload FunctionにLintが対応していないのでコメントアウト
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' | 'sensitiveChannel';
*/
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' | 'sensitiveChannel' {
if (mutedWords == null) return false;

if (checkWordMute(noteToCheck, $i, mutedWords)) return true;
Expand All @@ -284,8 +291,8 @@ function checkMute(noteToCheck: Misskey.entities.Note, mutedWords: Array<string

if (checkOnly) return false;

if (collapseSensitiveChannel && noteToCheck.channel?.isSensitive) return 'sensitiveChannel';
if (inTimeline && !defaultStore.state.tl.filter.withSensitive && noteToCheck.files?.some((v) => v.isSensitive)) return 'sensitiveMute';
if (collapseSensitiveChannel && noteToCheck.channel?.isSensitive) return 'sensitiveMute';
return false;
}

Expand Down

0 comments on commit 43dd672

Please sign in to comment.