fix: Scheduled post cannot send post with attachments

This commit is contained in:
Lhcfl 2024-05-22 14:49:22 +08:00
parent 26926a2e42
commit fc8357302d
2 changed files with 4 additions and 3 deletions

View file

@ -1,4 +1,4 @@
import { Users, Notes, ScheduledNotes } from "@/models/index.js"; import { Users, Notes, ScheduledNotes, DriveFiles } from "@/models/index.js";
import type { DbUserScheduledNoteData } from "@/queue/types.js"; import type { DbUserScheduledNoteData } from "@/queue/types.js";
import { queueLogger } from "../../logger.js"; import { queueLogger } from "../../logger.js";
import type Bull from "bull"; import type Bull from "bull";
@ -25,6 +25,7 @@ export async function scheduledNote(
done(); done();
return; return;
} }
const files = await DriveFiles.findBy({ id: In(note.fileIds) });
if (user.isSuspended) { if (user.isSuspended) {
deleteNote(user, note); deleteNote(user, note);
@ -45,7 +46,7 @@ export async function scheduledNote(
await createNote(user, { await createNote(user, {
createdAt: new Date(), createdAt: new Date(),
files: note.files, files,
poll: job.data.option.poll, poll: job.data.option.poll,
text: note.text || undefined, text: note.text || undefined,
lang: note.lang, lang: note.lang,

View file

@ -13,7 +13,7 @@
<i <i
v-else-if="note.visibility === 'specified' && note.scheduledAt" v-else-if="note.visibility === 'specified' && note.scheduledAt"
ref="specified" ref="specified"
v-tooltip="i18n.t('scheduledPostAt', { time: note.scheduledAt })" v-tooltip="i18n.t('scheduledPostAt', { time: (new Date(note.scheduledAt)).toLocaleString() })"
:class="icon('ph-clock')" :class="icon('ph-clock')"
></i> ></i>
<i <i