fix(backend): improve NoteDraftService validation

This commit is contained in:
syuilo 2025-10-08 17:50:04 +09:00
parent d4df749f4f
commit b25810e091
1 changed files with 6 additions and 2 deletions

View File

@ -172,8 +172,12 @@ export class NoteDraftService {
me: MiLocalUser,
data: Partial<NoteDraftOptions>,
): Promise<void> {
if (data.isActuallyScheduled && data.scheduledAt == null) {
if (data.isActuallyScheduled) {
if (data.scheduledAt == null) {
throw new IdentifiableError('94a89a43-3591-400a-9c17-dd166e71fdfa', 'scheduledAt is required when isActuallyScheduled is true');
} else if (data.scheduledAt.getTime() < Date.now()) {
throw new IdentifiableError('b34d0c1b-996f-4e34-a428-c636d98df457', 'scheduledAt must be in the future');
}
}
if (data.pollExpiresAt != null) {