wip
This commit is contained in:
parent
1df36d5fc7
commit
2faa39f5ae
|
@ -236,24 +236,25 @@ export class NoteCreateService implements OnApplicationShutdown {
|
||||||
isBot: MiUser['isBot'];
|
isBot: MiUser['isBot'];
|
||||||
isCat: MiUser['isCat'];
|
isCat: MiUser['isCat'];
|
||||||
}, data: {
|
}, data: {
|
||||||
|
createdAt: Date;
|
||||||
replyId: MiNote['id'] | null;
|
replyId: MiNote['id'] | null;
|
||||||
renoteId: MiNote['id'] | null;
|
renoteId: MiNote['id'] | null;
|
||||||
fileIds: MiDriveFile['id'][];
|
fileIds: MiDriveFile['id'][];
|
||||||
text: string | null;
|
text: string | null;
|
||||||
cw: string | null;
|
cw: string | null;
|
||||||
visibility: string | null;
|
visibility: string;
|
||||||
visibleUserIds: MiUser['id'][];
|
visibleUserIds: MiUser['id'][];
|
||||||
channelId: MiChannel['id'] | null;
|
channelId: MiChannel['id'] | null;
|
||||||
localOnly: boolean | null;
|
localOnly: boolean | null;
|
||||||
reactionAcceptance: MiNote['reactionAcceptance'];
|
reactionAcceptance: MiNote['reactionAcceptance'];
|
||||||
|
poll: IPoll | null;
|
||||||
|
apMentions?: MinimumUser[] | null;
|
||||||
|
apHashtags?: string[] | null;
|
||||||
|
apEmojis?: string[] | null;
|
||||||
}): Promise<MiNote> {
|
}): Promise<MiNote> {
|
||||||
let visibleUsers: MiUser[] = [];
|
const visibleUsers = data.visibleUserIds.length > 0 ? await this.usersRepository.findBy({
|
||||||
if (data.visibleUserIds) {
|
id: In(data.visibleUserIds),
|
||||||
visibleUsers = await this.usersRepository.findBy({
|
}) : [];
|
||||||
id: In(data.visibleUserIds),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
let files: MiDriveFile[] = [];
|
let files: MiDriveFile[] = [];
|
||||||
if (data.fileIds.length > 0) {
|
if (data.fileIds.length > 0) {
|
||||||
|
@ -354,7 +355,7 @@ export class NoteCreateService implements OnApplicationShutdown {
|
||||||
|
|
||||||
if (data.poll) {
|
if (data.poll) {
|
||||||
if (data.poll.expiresAt != null) {
|
if (data.poll.expiresAt != null) {
|
||||||
if (ps.poll.expiresAt < Date.now()) {
|
if (data.poll.expiresAt.getTime() < 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');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -372,11 +373,7 @@ export class NoteCreateService implements OnApplicationShutdown {
|
||||||
return this.create(user, {
|
return this.create(user, {
|
||||||
createdAt: new Date(),
|
createdAt: new Date(),
|
||||||
files: files,
|
files: files,
|
||||||
poll: ps.poll ? {
|
poll: data.poll,
|
||||||
choices: ps.poll.choices,
|
|
||||||
multiple: ps.poll.multiple ?? false,
|
|
||||||
expiresAt: ps.poll.expiresAt ? new Date(ps.poll.expiresAt) : null,
|
|
||||||
} : undefined,
|
|
||||||
text: data.text ?? undefined,
|
text: data.text ?? undefined,
|
||||||
reply,
|
reply,
|
||||||
renote,
|
renote,
|
||||||
|
@ -386,9 +383,9 @@ export class NoteCreateService implements OnApplicationShutdown {
|
||||||
visibility: data.visibility,
|
visibility: data.visibility,
|
||||||
visibleUsers,
|
visibleUsers,
|
||||||
channel,
|
channel,
|
||||||
apMentions: data.noExtractMentions ? [] : undefined,
|
apMentions: data.apMentions,
|
||||||
apHashtags: data.noExtractHashtags ? [] : undefined,
|
apHashtags: data.apHashtags,
|
||||||
apEmojis: data.noExtractEmojis ? [] : undefined,
|
apEmojis: data.apEmojis,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,9 +54,6 @@ export class PostScheduledNoteProcessorService {
|
||||||
visibility: draft.visibility,
|
visibility: draft.visibility,
|
||||||
visibleUserIds: draft.visibleUserIds,
|
visibleUserIds: draft.visibleUserIds,
|
||||||
channelId: draft.channelId,
|
channelId: draft.channelId,
|
||||||
apMentions: draft.noExtractMentions ? [] : undefined,
|
|
||||||
apHashtags: draft.noExtractHashtags ? [] : undefined,
|
|
||||||
apEmojis: draft.noExtractEmojis ? [] : undefined,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// await不要
|
// await不要
|
||||||
|
|
Loading…
Reference in New Issue