refactor
This commit is contained in:
@ -1,15 +1,15 @@
|
||||
import renderDocument from './document.js';
|
||||
import renderHashtag from './hashtag.js';
|
||||
import renderMention from './mention.js';
|
||||
import renderEmoji from './emoji.js';
|
||||
import { In, IsNull } from 'typeorm';
|
||||
import config from '@/config/index.js';
|
||||
import toHtml from '../misc/get-note-html.js';
|
||||
import { Note, IMentionedRemoteUsers } from '@/models/entities/note.js';
|
||||
import { DriveFile } from '@/models/entities/drive-file.js';
|
||||
import { DriveFiles, Notes, Users, Emojis, Polls } from '@/models/index.js';
|
||||
import { In, IsNull } from 'typeorm';
|
||||
import { Emoji } from '@/models/entities/emoji.js';
|
||||
import { Poll } from '@/models/entities/poll.js';
|
||||
import toHtml from '../misc/get-note-html.js';
|
||||
import renderEmoji from './emoji.js';
|
||||
import renderMention from './mention.js';
|
||||
import renderHashtag from './hashtag.js';
|
||||
import renderDocument from './document.js';
|
||||
|
||||
export default async function renderNote(note: Note, dive = true, isTalk = false): Promise<Record<string, unknown>> {
|
||||
const getPromisedFiles = async (ids: string[]) => {
|
||||
@ -83,7 +83,7 @@ export default async function renderNote(note: Note, dive = true, isTalk = false
|
||||
const files = await getPromisedFiles(note.fileIds);
|
||||
|
||||
const text = note.text;
|
||||
let poll: Poll | null;
|
||||
let poll: Poll | null = null;
|
||||
|
||||
if (note.hasPoll) {
|
||||
poll = await Polls.findOneBy({ noteId: note.id });
|
||||
@ -159,7 +159,7 @@ export async function getEmojis(names: string[]): Promise<Emoji[]> {
|
||||
names.map(name => Emojis.findOneBy({
|
||||
name,
|
||||
host: IsNull(),
|
||||
}))
|
||||
})),
|
||||
);
|
||||
|
||||
return emojis.filter(emoji => emoji != null) as Emoji[];
|
||||
|
Reference in New Issue
Block a user