fix(backend): フィードのノートのMFMはHTMLにレンダーしてから返す (#14006)
* fix(backend): フィードのノートのMFMはHTMLにレンダーしてから返す (test wip) * chore: beforeEachを使う? * fix: プレーンテキストにフォールバックしてMFMが含まれていないか調べる方針を実装 * fix: application/jsonだとパースされるのでその作用をキャンセル * build: fix lint error * docs: update CHANGELOG.md --------- Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
This commit is contained in:
@@ -14,6 +14,8 @@ import { UserEntityService } from '@/core/entities/UserEntityService.js';
|
||||
import { DriveFileEntityService } from '@/core/entities/DriveFileEntityService.js';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
import { IdService } from '@/core/IdService.js';
|
||||
import { MfmService } from "@/core/MfmService.js";
|
||||
import { parse as mfmParse } from 'mfm-js';
|
||||
|
||||
@Injectable()
|
||||
export class FeedService {
|
||||
@@ -33,6 +35,7 @@ export class FeedService {
|
||||
private userEntityService: UserEntityService,
|
||||
private driveFileEntityService: DriveFileEntityService,
|
||||
private idService: IdService,
|
||||
private mfmService: MfmService,
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -76,13 +79,14 @@ export class FeedService {
|
||||
id: In(note.fileIds),
|
||||
}) : [];
|
||||
const file = files.find(file => file.type.startsWith('image/'));
|
||||
const text = note.text;
|
||||
|
||||
feed.addItem({
|
||||
title: `New note by ${author.name}`,
|
||||
link: `${this.config.url}/notes/${note.id}`,
|
||||
date: this.idService.parse(note.id).date,
|
||||
description: note.cw ?? undefined,
|
||||
content: note.text ?? undefined,
|
||||
content: text ? this.mfmService.toHtml(mfmParse(text), JSON.parse(note.mentionedRemoteUsers)) ?? undefined : undefined,
|
||||
image: file ? this.driveFileEntityService.getPublicUrl(file) : undefined,
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user