summaryrefslogtreecommitdiff
path: root/src/remote/activitypub
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2021-04-02 10:36:11 +0900
committerGitHub <noreply@github.com>2021-04-02 10:36:11 +0900
commit1f4ae2f63a609d51942daa23772439379496064e (patch)
tree55e67e216bd30b8a5c95f769e8696c4b885d1e61 /src/remote/activitypub
parenttweak avatar generation (diff)
downloadsharkey-1f4ae2f63a609d51942daa23772439379496064e.tar.gz
sharkey-1f4ae2f63a609d51942daa23772439379496064e.tar.bz2
sharkey-1f4ae2f63a609d51942daa23772439379496064e.zip
Use mfm-js for MFM parsing (#7415)
* wip * Update mfm.ts * wip * update mfmjs * refactor * nanka * Update mfm.ts * Update to-html.ts * Update to-html.ts * wip * fix test * fix test
Diffstat (limited to 'src/remote/activitypub')
-rw-r--r--src/remote/activitypub/misc/get-note-html.ts4
-rw-r--r--src/remote/activitypub/renderer/person.ts4
2 files changed, 4 insertions, 4 deletions
diff --git a/src/remote/activitypub/misc/get-note-html.ts b/src/remote/activitypub/misc/get-note-html.ts
index 6990a4ae5e..683860d9cc 100644
--- a/src/remote/activitypub/misc/get-note-html.ts
+++ b/src/remote/activitypub/misc/get-note-html.ts
@@ -1,9 +1,9 @@
+import * as mfm from 'mfm-js';
import { Note } from '../../../models/entities/note';
import { toHtml } from '../../../mfm/to-html';
-import { parse } from '../../../mfm/parse';
export default function(note: Note) {
- let html = toHtml(parse(note.text), JSON.parse(note.mentionedRemoteUsers));
+ let html = note.text ? toHtml(mfm.parse(note.text), JSON.parse(note.mentionedRemoteUsers)) : null;
if (html == null) html = '<p>.</p>';
return html;
diff --git a/src/remote/activitypub/renderer/person.ts b/src/remote/activitypub/renderer/person.ts
index e4e8f24f10..91b91bff92 100644
--- a/src/remote/activitypub/renderer/person.ts
+++ b/src/remote/activitypub/renderer/person.ts
@@ -1,10 +1,10 @@
import { URL } from 'url';
+import * as mfm from 'mfm-js';
import renderImage from './image';
import renderKey from './key';
import config from '@/config';
import { ILocalUser } from '../../../models/entities/user';
import { toHtml } from '../../../mfm/to-html';
-import { parse } from '../../../mfm/parse';
import { getEmojis } from './note';
import renderEmoji from './emoji';
import { IIdentifier } from '../models/identifier';
@@ -66,7 +66,7 @@ export async function renderPerson(user: ILocalUser) {
url: `${config.url}/@${user.username}`,
preferredUsername: user.username,
name: user.name,
- summary: toHtml(parse(profile.description)),
+ summary: profile.description ? toHtml(mfm.parse(profile.description)) : null,
icon: avatar ? renderImage(avatar) : null,
image: banner ? renderImage(banner) : null,
tag,