From e5bdb3fbe51b7106e8d9df3d4c5f3df12bbe83b2 Mon Sep 17 00:00:00 2001 From: NoriDev Date: Sun, 2 Feb 2025 03:10:43 +0900 Subject: [PATCH] =?UTF-8?q?fix(backend):=20=EC=B1=84=EB=84=90=EC=97=90?= =?UTF-8?q?=EC=84=9C=20`=EB=85=B8=ED=8A=B8=20=EA=B2=8C=EC=8B=9C=20?= =?UTF-8?q?=EC=98=88=EC=95=BD`=EC=9D=84=20=EC=82=AC=EC=9A=A9=ED=95=98?= =?UTF-8?q?=EB=A9=B4=20=EC=B1=84=EB=84=90=20=ED=83=80=EC=9E=84=EB=9D=BC?= =?UTF-8?q?=EC=9D=B8=EC=9D=B4=20=EC=95=84=EB=8B=8C=20=EC=9D=BC=EB=B0=98=20?= =?UTF-8?q?=ED=83=80=EC=9E=84=EB=9D=BC=EC=9D=B8=EC=97=90=20=EA=B2=8C?= =?UTF-8?q?=EC=8B=9C=EB=90=A8=20(kokonect-link/cherrypick#559)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG_CHERRYPICK.md | 1 + .../server/api/endpoints/notes/schedule/create.ts | 15 +++++++++++++-- packages/cherrypick-js/src/autogen/types.ts | 2 ++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/CHANGELOG_CHERRYPICK.md b/CHANGELOG_CHERRYPICK.md index 9f2155b01f..27ddba56e3 100644 --- a/CHANGELOG_CHERRYPICK.md +++ b/CHANGELOG_CHERRYPICK.md @@ -50,6 +50,7 @@ Misskey의 전체 변경 사항을 확인하려면, [CHANGELOG.md#2024xx](CHANGE ### Server - Fix: 신고 즉시 해결 기능에서 발생할 수 있는 일부 문제 해결 ([misskey-dev/misskey#11032 (review)](https://github.com/misskey-dev/misskey/pull/11032#pullrequestreview-2425669540)) - forward가 `true`가 되면 `false`로 변경할 수 없음 +- Fix: 채널에서 `노트 게시 예약`을 사용하면 채널 타임라인이 아닌 일반 타임라인에 게시됨 (kokonect-link/cherrypick#559) --- diff --git a/packages/backend/src/server/api/endpoints/notes/schedule/create.ts b/packages/backend/src/server/api/endpoints/notes/schedule/create.ts index c38f9fb537..916a2ce920 100644 --- a/packages/backend/src/server/api/endpoints/notes/schedule/create.ts +++ b/packages/backend/src/server/api/endpoints/notes/schedule/create.ts @@ -14,7 +14,7 @@ import type { BlockingsRepository, DriveFilesRepository, ChannelsRepository, - NoteScheduleRepository, + NoteScheduleRepository, MiChannel, } from '@/models/_.js'; import type { MiDriveFile } from '@/models/DriveFile.js'; import type { MiNote } from '@/models/Note.js'; @@ -148,6 +148,7 @@ export const paramDef = { noExtractEmojis: { type: 'boolean', default: false }, replyId: { type: 'string', format: 'misskey:id', nullable: true }, renoteId: { type: 'string', format: 'misskey:id', nullable: true }, + channelId: { type: 'string', format: 'misskey:id', nullable: true }, // anyOf内にバリデーションを書いても最初の一つしかチェックされない // See https://github.com/misskey-dev/misskey/pull/10082 @@ -366,6 +367,15 @@ export default class extends Endpoint { // eslint- } } + let channel: MiChannel | null = null; + if (ps.channelId != null) { + channel = await this.channelsRepository.findOneBy({ id: ps.channelId, isArchived: false }); + + if (channel == null) { + throw new ApiError(meta.errors.noSuchChannel); + } + } + if (typeof ps.scheduleNote.scheduledAt === 'number') { if (ps.scheduleNote.scheduledAt < Date.now()) { throw new ApiError(meta.errors.cannotCreateAlreadyExpiredSchedule); @@ -384,7 +394,7 @@ export default class extends Endpoint { // eslint- } } - const note:MiScheduleNoteType = { + const note: MiScheduleNoteType = { createdAt: new Date(ps.scheduleNote.scheduledAt!).toISOString(), files: files.map(f => f.id), poll: ps.poll ? { @@ -400,6 +410,7 @@ export default class extends Endpoint { // eslint- reactionAcceptance: ps.reactionAcceptance, visibility: ps.visibility, visibleUsers, + channel: channel?.id, apMentions: ps.noExtractMentions ? [] : undefined, apHashtags: ps.noExtractHashtags ? [] : undefined, apEmojis: ps.noExtractEmojis ? [] : undefined, diff --git a/packages/cherrypick-js/src/autogen/types.ts b/packages/cherrypick-js/src/autogen/types.ts index 63b3651f53..a4961b096f 100644 --- a/packages/cherrypick-js/src/autogen/types.ts +++ b/packages/cherrypick-js/src/autogen/types.ts @@ -25109,6 +25109,8 @@ export type operations = { replyId?: string | null; /** Format: misskey:id */ renoteId?: string | null; + /** Format: misskey:id */ + channelId?: string | null; text?: string | null; fileIds?: string[]; mediaIds?: string[];