Preserve the attached order in AP

This commit is contained in:
mei23 2019-10-29 05:51:38 +09:00
parent 1e58b3daff
commit 8ac09cc81b
No known key found for this signature in database
GPG key ID: DD8628500D3E4B23

View file

@ -13,10 +13,6 @@ import { Poll } from '../../../models/entities/poll';
import { ensure } from '../../../prelude/ensure';
export default async function renderNote(note: Note, dive = true): Promise<any> {
const promisedFiles: Promise<DriveFile[]> = note.fileIds.length > 0
? DriveFiles.find({ id: In(note.fileIds) })
: Promise.resolve([]);
let inReplyTo;
let inReplyToNote: Note | undefined;
@ -81,7 +77,7 @@ export default async function renderNote(note: Note, dive = true): Promise<any>
const hashtagTags = (note.tags || []).map(tag => renderHashtag(tag));
const mentionTags = mentionedUsers.map(u => renderMention(u));
const files = await promisedFiles;
const files = (await Promise.all((note.fileIds || []).map(x => DriveFiles.findOne(x)))).filter(x => x != null) as DriveFile[];
let text = note.text;
let poll: Poll | undefined;