feat: respect cat language conversion settings
This commit is contained in:
parent
c630187b2e
commit
fb1ac0e001
1 changed files with 30 additions and 30 deletions
|
@ -43,10 +43,6 @@ import { isFiltered } from "@/misc/is-filtered.js";
|
||||||
import { unfurl } from "unfurl.js";
|
import { unfurl } from "unfurl.js";
|
||||||
|
|
||||||
export class NoteConverter {
|
export class NoteConverter {
|
||||||
private static noteContentHtmlCache = new Cache<string | null>(
|
|
||||||
"html:note:content",
|
|
||||||
60 * 60,
|
|
||||||
);
|
|
||||||
private static cardCache = new Cache<MastodonEntity.Card | null>(
|
private static cardCache = new Cache<MastodonEntity.Card | null>(
|
||||||
"note:card",
|
"note:card",
|
||||||
60 * 60,
|
60 * 60,
|
||||||
|
@ -197,34 +193,38 @@ export class NoteConverter {
|
||||||
: null,
|
: null,
|
||||||
)
|
)
|
||||||
.then(async (text) => {
|
.then(async (text) => {
|
||||||
const user = await Users.findOneBy({ id: note.userId });
|
return awaitAll({
|
||||||
if (user?.isCat && user?.speakAsCat && text != null) {
|
noteUser,
|
||||||
return this.applyNyaification(text, note.lang);
|
user,
|
||||||
}
|
}).then(({ noteUser, user }) => {
|
||||||
return text;
|
if (
|
||||||
|
noteUser.isCat &&
|
||||||
|
noteUser.speakAsCat &&
|
||||||
|
text != null &&
|
||||||
|
(user == null || user.readCatLanguage)
|
||||||
|
) {
|
||||||
|
return this.applyNyaification(text, note.lang);
|
||||||
|
}
|
||||||
|
return text;
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
const content = this.noteContentHtmlCache
|
const content = text
|
||||||
.fetch(
|
.then((text) =>
|
||||||
identifier,
|
text !== null
|
||||||
async () =>
|
? quoteUri
|
||||||
text.then((text) =>
|
.then((quoteUri) =>
|
||||||
text !== null
|
MfmHelpers.toHtml(
|
||||||
? quoteUri
|
mfm.parse(text),
|
||||||
.then((quoteUri) =>
|
JSON.parse(note.mentionedRemoteUsers),
|
||||||
MfmHelpers.toHtml(
|
note.userHost,
|
||||||
mfm.parse(text),
|
false,
|
||||||
JSON.parse(note.mentionedRemoteUsers),
|
quoteUri,
|
||||||
note.userHost,
|
ctx,
|
||||||
false,
|
),
|
||||||
quoteUri,
|
)
|
||||||
ctx,
|
.then((p) => p ?? escapeMFM(text))
|
||||||
),
|
: "",
|
||||||
)
|
|
||||||
.then((p) => p ?? escapeMFM(text))
|
|
||||||
: "",
|
|
||||||
),
|
|
||||||
true,
|
|
||||||
)
|
)
|
||||||
.then((p) => p ?? "");
|
.then((p) => p ?? "");
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue