From 82526ad4f39ce5864feef2dabf9ec2feb810d063 Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 3 Nov 2023 08:17:35 +0900 Subject: [PATCH] =?UTF-8?q?CW=E3=82=92=E4=BD=BF=E7=94=A8=E3=81=99=E3=82=8B?= =?UTF-8?q?=E5=A0=B4=E5=90=88=E3=80=81=E6=B3=A8=E9=87=88=E3=82=92=E7=A9=BA?= =?UTF-8?q?=E3=81=AB=E3=81=99=E3=82=8B=E3=81=93=E3=81=A8=E3=82=92=E8=A8=B1?= =?UTF-8?q?=E5=8F=AF=E3=81=97=E3=81=AA=E3=81=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Resolve #12217 --- CHANGELOG.md | 1 + locales/index.d.ts | 1 + locales/ja-JP.yml | 1 + packages/backend/src/server/api/endpoints/notes/create.ts | 4 ++-- packages/frontend/src/components/MkPostForm.vue | 8 ++++++++ 5 files changed, 13 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 42b132089..82822c903 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ - Enhance: 未読の通知数を表示できるように - Enhance: ローカリゼーションの更新 - Enhance: 依存関係の更新 +- Change: CWを使用する場合、注釈を空にすることは許可されなくなりました ### Client - Feat: プラグイン・テーマを外部サイトから直接インストールできるようになりました diff --git a/locales/index.d.ts b/locales/index.d.ts index eb2798308..b8dc3a68b 100644 --- a/locales/index.d.ts +++ b/locales/index.d.ts @@ -1158,6 +1158,7 @@ export interface Locale { "pullDownToRefresh": string; "disableStreamingTimeline": string; "useGroupedNotifications": string; + "cwNotationRequired": string; "_announcement": { "forExistingUsers": string; "forExistingUsersDescription": string; diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 4af21ab52..76b5386b3 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -1155,6 +1155,7 @@ refreshing: "リロード中" pullDownToRefresh: "引っ張ってリロード" disableStreamingTimeline: "タイムラインのリアルタイム更新を無効にする" useGroupedNotifications: "通知をグルーピングして表示する" +cwNotationRequired: "「内容を隠す」がオンの場合は注釈の記述が必要です。" _announcement: forExistingUsers: "既存ユーザーのみ" diff --git a/packages/backend/src/server/api/endpoints/notes/create.ts b/packages/backend/src/server/api/endpoints/notes/create.ts index 649068fb2..fb650f69f 100644 --- a/packages/backend/src/server/api/endpoints/notes/create.ts +++ b/packages/backend/src/server/api/endpoints/notes/create.ts @@ -16,8 +16,8 @@ import { Endpoint } from '@/server/api/endpoint-base.js'; import { NoteEntityService } from '@/core/entities/NoteEntityService.js'; import { NoteCreateService } from '@/core/NoteCreateService.js'; import { DI } from '@/di-symbols.js'; -import { ApiError } from '../../error.js'; import { isPureRenote } from '@/misc/is-pure-renote.js'; +import { ApiError } from '../../error.js'; export const meta = { tags: ['notes'], @@ -109,7 +109,7 @@ export const paramDef = { visibleUserIds: { type: 'array', uniqueItems: true, items: { type: 'string', format: 'misskey:id', } }, - cw: { type: 'string', nullable: true, maxLength: 100 }, + cw: { type: 'string', nullable: true, minLength: 1, maxLength: 100 }, localOnly: { type: 'boolean', default: false }, reactionAcceptance: { type: 'string', nullable: true, enum: [null, 'likeOnly', 'likeOnlyForRemote', 'nonSensitiveOnly', 'nonSensitiveOnlyForLocalLikeOnlyForRemote'], default: null }, noExtractMentions: { type: 'boolean', default: false }, diff --git a/packages/frontend/src/components/MkPostForm.vue b/packages/frontend/src/components/MkPostForm.vue index 598846b16..1fa568586 100644 --- a/packages/frontend/src/components/MkPostForm.vue +++ b/packages/frontend/src/components/MkPostForm.vue @@ -658,6 +658,14 @@ function deleteDraft() { } async function post(ev?: MouseEvent) { + if (useCw && (cw == null || cw.trim() === '')) { + os.alert({ + type: 'error', + text: i18n.ts.cwNotationRequired, + }); + return; + } + if (ev) { const el = ev.currentTarget ?? ev.target; const rect = el.getBoundingClientRect();