From 8ac09cc81b1c216edccd2eba4bbdf0a194320883 Mon Sep 17 00:00:00 2001 From: mei23 Date: Tue, 29 Oct 2019 05:51:38 +0900 Subject: [PATCH] Preserve the attached order in AP --- src/remote/activitypub/renderer/note.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/remote/activitypub/renderer/note.ts b/src/remote/activitypub/renderer/note.ts index ca823941c0..f735a13883 100644 --- a/src/remote/activitypub/renderer/note.ts +++ b/src/remote/activitypub/renderer/note.ts @@ -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 { - const promisedFiles: Promise = 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 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;