Fix bug
This commit is contained in:
parent
020cc471da
commit
b21b33831a
@ -6,6 +6,7 @@ import DriveFile, { IDriveFile } from '../../../models/drive-file';
|
|||||||
import Note, { INote } from '../../../models/note';
|
import Note, { INote } from '../../../models/note';
|
||||||
import User from '../../../models/user';
|
import User from '../../../models/user';
|
||||||
import toHtml from '../misc/get-note-html';
|
import toHtml from '../misc/get-note-html';
|
||||||
|
import parseMfm from '../../../mfm/parse';
|
||||||
|
|
||||||
export default async function renderNote(note: INote, dive = true): Promise<any> {
|
export default async function renderNote(note: INote, dive = true): Promise<any> {
|
||||||
const promisedFiles: Promise<IDriveFile[]> = note.fileIds
|
const promisedFiles: Promise<IDriveFile[]> = note.fileIds
|
||||||
@ -81,13 +82,21 @@ export default async function renderNote(note: INote, dive = true): Promise<any>
|
|||||||
|
|
||||||
const files = await promisedFiles;
|
const files = await promisedFiles;
|
||||||
|
|
||||||
|
const text = note.text ? parseMfm(note.text).map(x => {
|
||||||
|
if (x.type == 'mention' && x.host == null) {
|
||||||
|
return `${x.content}@${config.host}`;
|
||||||
|
} else {
|
||||||
|
return x.content;
|
||||||
|
}
|
||||||
|
}).join('') : null;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id: `${config.url}/notes/${note._id}`,
|
id: `${config.url}/notes/${note._id}`,
|
||||||
type: 'Note',
|
type: 'Note',
|
||||||
attributedTo,
|
attributedTo,
|
||||||
summary: note.cw,
|
summary: note.cw,
|
||||||
content: toHtml(note),
|
content: toHtml(note),
|
||||||
_misskey_content: note.text,
|
_misskey_content: text,
|
||||||
published: note.createdAt.toISOString(),
|
published: note.createdAt.toISOString(),
|
||||||
to,
|
to,
|
||||||
cc,
|
cc,
|
||||||
|
Loading…
Reference in New Issue
Block a user