simplify
This commit is contained in:
parent
5964a10571
commit
414f6df104
@ -204,14 +204,7 @@ export const NoteRepository = db.getRepository(Note).extend({
|
|||||||
host,
|
host,
|
||||||
);
|
);
|
||||||
|
|
||||||
let lang;
|
const lang = detectLanguage_(`${note.cw ?? ''}\n${note.text ?? ''}`) ?? "unknown"
|
||||||
try {
|
|
||||||
lang = (detectLanguage_((note.text || "") + (note.cw || "")))
|
|
||||||
.languages[0].code;
|
|
||||||
} catch (e) {
|
|
||||||
lang =
|
|
||||||
detect((note.text || "") + (note.cw || ""))?.[0]?.lang || "unknown";
|
|
||||||
}
|
|
||||||
const reactionEmoji = await populateEmojis(reactionEmojiNames, host);
|
const reactionEmoji = await populateEmojis(reactionEmojiNames, host);
|
||||||
const packed: Packed<"Note"> = await awaitAll({
|
const packed: Packed<"Note"> = await awaitAll({
|
||||||
id: note.id,
|
id: note.id,
|
||||||
|
Loading…
Reference in New Issue
Block a user