From 2ad393ea45931a9a17207d91f17fcb48b81a0e88 Mon Sep 17 00:00:00 2001 From: syuilo <4439005+syuilo@users.noreply.github.com> Date: Wed, 26 Nov 2025 09:55:02 +0900 Subject: [PATCH] =?UTF-8?q?fix(backend):=20=E3=83=AF=E3=83=BC=E3=83=89?= =?UTF-8?q?=E3=83=9F=E3=83=A5=E3=83=BC=E3=83=88=E3=81=AE=E6=96=87=E5=AD=97?= =?UTF-8?q?=E6=95=B0=E8=A8=88=E7=AE=97=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 1 + .../backend/src/server/api/endpoints/i/update.ts | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 284afbd313..a625dd5d96 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ - Enhance: `clips/my-favorites` APIがページネーションに対応しました - Enhance: メモリ使用量を削減しました - Enhance: 依存関係の更新 +- Fix: ワードミュートの文字数計算を修正 - Fix: チャンネルのリアルタイム更新時に、ロックダウン設定にて非ログイン時にノートを表示しない設定にしている場合でもノートが表示されてしまう問題を修正 - Fix: DeepL APIのAPIキー指定方式変更に対応 (Cherry-picked from https://github.com/MisskeyIO/misskey/pull/1096) diff --git a/packages/backend/src/server/api/endpoints/i/update.ts b/packages/backend/src/server/api/endpoints/i/update.ts index 5c7958fc1c..113a09cb14 100644 --- a/packages/backend/src/server/api/endpoints/i/update.ts +++ b/packages/backend/src/server/api/endpoints/i/update.ts @@ -295,8 +295,20 @@ export default class extends Endpoint { // eslint- if (ps.chatScope !== undefined) updates.chatScope = ps.chatScope; function checkMuteWordCount(mutedWords: (string[] | string)[], limit: number) { - // TODO: ちゃんと数える - const length = JSON.stringify(mutedWords).length; + const count = (arr: (string[] | string)[]) => { + let length = 0; + for (const item of arr) { + if (typeof item === 'string') { + length += item.length; + } else if (Array.isArray(item)) { + for (const subItem of item) { + length += subItem.length; + } + } + } + return length; + }; + const length = count(mutedWords); if (length > limit) { throw new ApiError(meta.errors.tooManyMutedWords); }