This commit is contained in:
syuilo 2025-09-25 15:32:50 +09:00
parent 2ab2081caa
commit 914eb0bd35
3 changed files with 7 additions and 9 deletions

View File

@ -357,8 +357,6 @@ export class NoteCreateService implements OnApplicationShutdown {
if (ps.poll.expiresAt < Date.now()) { if (ps.poll.expiresAt < Date.now()) {
throw new IdentifiableError('0c11c11e-0c8d-48e7-822c-76ccef660068', 'Poll expiration must be future time'); throw new IdentifiableError('0c11c11e-0c8d-48e7-822c-76ccef660068', 'Poll expiration must be future time');
} }
} else if (typeof ps.poll.expiredAfter === 'number') {
ps.poll.expiresAt = Date.now() + ps.poll.expiredAfter;
} }
} }

View File

@ -40,11 +40,11 @@ export class PostScheduledNoteProcessorService {
const note = await this.noteCreateService.fetchAndCreate(draft.user, { const note = await this.noteCreateService.fetchAndCreate(draft.user, {
createdAt: new Date(), createdAt: new Date(),
fileIds: draft.fileIds, fileIds: draft.fileIds,
poll: ps.poll ? { poll: draft.hasPoll ? {
choices: ps.poll.choices, choices: draft.pollChoices,
multiple: ps.poll.multiple ?? false, multiple: draft.pollMultiple,
expiresAt: ps.poll.expiresAt ? new Date(ps.poll.expiresAt) : null, expiresAt: draft.pollExpiredAfter ? new Date(Date.now() + draft.pollExpiredAfter) : draft.pollExpiresAt ? new Date(draft.pollExpiresAt) : null,
} : undefined, } : null,
text: draft.text ?? null, text: draft.text ?? null,
replyId: draft.replyId, replyId: draft.replyId,
renoteId: draft.renoteId, renoteId: draft.renoteId,

View File

@ -227,8 +227,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
poll: ps.poll ? { poll: ps.poll ? {
choices: ps.poll.choices, choices: ps.poll.choices,
multiple: ps.poll.multiple ?? false, multiple: ps.poll.multiple ?? false,
expiresAt: ps.poll.expiresAt ? new Date(ps.poll.expiresAt) : null, expiresAt: ps.poll.expiredAfter ? new Date(Date.now() + ps.poll.expiredAfter) : ps.poll.expiresAt ? new Date(ps.poll.expiresAt) : null,
} : undefined, } : null,
text: ps.text ?? null, text: ps.text ?? null,
replyId: ps.replyId ?? null, replyId: ps.replyId ?? null,
renoteId: ps.renoteId ?? null, renoteId: ps.renoteId ?? null,