Preserve the attached order in AP (#5561)
* Preserve the attached order in AP * Revert "Preserve the attached order in AP" This reverts commit 8ac09cc81b1c216edccd2eba4bbdf0a194320883. * use IN
This commit is contained in:
parent
0c1d3e186b
commit
93a889df82
1 changed files with 6 additions and 4 deletions
|
@ -13,9 +13,11 @@ import { Poll } from '../../../models/entities/poll';
|
||||||
import { ensure } from '../../../prelude/ensure';
|
import { ensure } from '../../../prelude/ensure';
|
||||||
|
|
||||||
export default async function renderNote(note: Note, dive = true, isTalk = false): Promise<any> {
|
export default async function renderNote(note: Note, dive = true, isTalk = false): Promise<any> {
|
||||||
const promisedFiles: Promise<DriveFile[]> = note.fileIds.length > 0
|
const getPromisedFiles = async (ids: string[]) => {
|
||||||
? DriveFiles.find({ id: In(note.fileIds) })
|
if (!ids || ids.length === 0) return [];
|
||||||
: Promise.resolve([]);
|
const items = await DriveFiles.find({ id: In(ids) });
|
||||||
|
return ids.map(id => items.find(item => item.id === id)).filter(item => item != null) as DriveFile[];
|
||||||
|
};
|
||||||
|
|
||||||
let inReplyTo;
|
let inReplyTo;
|
||||||
let inReplyToNote: Note | undefined;
|
let inReplyToNote: Note | undefined;
|
||||||
|
@ -81,7 +83,7 @@ export default async function renderNote(note: Note, dive = true, isTalk = false
|
||||||
const hashtagTags = (note.tags || []).map(tag => renderHashtag(tag));
|
const hashtagTags = (note.tags || []).map(tag => renderHashtag(tag));
|
||||||
const mentionTags = mentionedUsers.map(u => renderMention(u));
|
const mentionTags = mentionedUsers.map(u => renderMention(u));
|
||||||
|
|
||||||
const files = await promisedFiles;
|
const files = await getPromisedFiles(note.fileIds);
|
||||||
|
|
||||||
let text = note.text;
|
let text = note.text;
|
||||||
let poll: Poll | undefined;
|
let poll: Poll | undefined;
|
||||||
|
|
Loading…
Reference in a new issue