diff --git a/packages/backend/src/mfm/from-html.ts b/packages/backend/src/mfm/from-html.ts
index 011265ad7..a2433af6e 100644
--- a/packages/backend/src/mfm/from-html.ts
+++ b/packages/backend/src/mfm/from-html.ts
@@ -7,7 +7,7 @@ const treeAdapter = parse5.defaultTreeAdapter;
const urlRegex = /^https?:\/\/[\w\/:%#@$&?!()\[\]~.,=+\-]+/;
const urlRegexFull = /^https?:\/\/[\w\/:%#@$&?!()\[\]~.,=+\-]+$/;
-export function fromHtml(html: string, hashtagNames?: string[]): string {
+export function fromHtml(html: string, hashtagNames?: string[], quoteUri?: string | null): string {
const dom = parse5.parseFragment(
// some AP servers like Pixelfed use br tags as well as newlines
html.replace(/
\r?\n/gi, '\n'),
@@ -202,6 +202,16 @@ export function fromHtml(html: string, hashtagNames?: string[]): string {
break;
}
+ case 'span':
+ {
+ if (node.classList.contains('quote-inline') && quoteUri && getText(node).trim() === `RE: ${quoteUri}`) {
+ // embedded quote thingy for backwards compatibility, don't show it
+ } else {
+ appendChildren(node.childNodes);
+ }
+ break;
+ }
+
default: // includes inline elements
{
appendChildren(node.childNodes);
diff --git a/packages/backend/src/remote/activitypub/misc/html-to-mfm.ts b/packages/backend/src/remote/activitypub/misc/html-to-mfm.ts
index c9c7f389a..41d2e3b62 100644
--- a/packages/backend/src/remote/activitypub/misc/html-to-mfm.ts
+++ b/packages/backend/src/remote/activitypub/misc/html-to-mfm.ts
@@ -2,8 +2,8 @@ import { IObject } from '../type.js';
import { extractApHashtagObjects } from '../models/tag.js';
import { fromHtml } from '@/mfm/from-html.js';
-export function htmlToMfm(html: string, tag?: IObject | IObject[]) {
+export function htmlToMfm(html: string, tag?: IObject | IObject[], quoteUri?: string | null) {
const hashtagNames = extractApHashtagObjects(tag).map(x => x.name).filter((x): x is string => x != null);
- return fromHtml(html, hashtagNames);
+ return fromHtml(html, hashtagNames, quoteUri);
}
diff --git a/packages/backend/src/remote/activitypub/models/note.ts b/packages/backend/src/remote/activitypub/models/note.ts
index 55989206e..0dc7d477d 100644
--- a/packages/backend/src/remote/activitypub/models/note.ts
+++ b/packages/backend/src/remote/activitypub/models/note.ts
@@ -194,14 +194,14 @@ export async function createNote(value: string | IObject, resolver?: Resolver =
const cw = note.summary === '' ? null : note.summary;
- // テキストのパース
+ // text parsing
let text: string | null = null;
if (note.source?.mediaType === 'text/x.misskeymarkdown' && typeof note.source.content === 'string') {
text = note.source.content;
} else if (typeof note._misskey_content !== 'undefined') {
text = note._misskey_content;
} else if (typeof note.content === 'string') {
- text = htmlToMfm(note.content, note.tag);
+ text = htmlToMfm(note.content, note.tag, quote.uri);
}
// vote