enhance(backend): 「内容を隠す」に設定されたノートの注釈も翻訳に含まれる

This commit is contained in:
NoriDev 2023-10-02 00:24:01 +09:00
parent d08c12b496
commit f7b3467981
2 changed files with 4 additions and 3 deletions

View file

@ -39,6 +39,7 @@ Misskey의 전체 변경 사항을 확인하려면, [CHANGELOG.md#2023xx](CHANGE
### Server
- 이모티콘 중복 체크 (misskey-dev/misskey#11941)
- Enhance: '내용 숨기기'로 설정된 노트의 주석도 번역에 포함됨
---

View file

@ -103,12 +103,12 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
if (instance.deeplAuthKey == null) {
return 204; // TODO: 良い感じのエラー返す
}
translationResult = await this.translateDeepL(note.text, targetLang, instance.deeplAuthKey, instance.deeplIsPro, instance.translatorType);
translationResult = await this.translateDeepL((note.cw ? note.cw + '\n' : '') + note.text, targetLang, instance.deeplAuthKey, instance.deeplIsPro, instance.translatorType);
} else if (instance.translatorType === 'google_no_api') {
let targetLang = ps.targetLang;
if (targetLang.includes('-')) targetLang = targetLang.split('-')[0];
const { text, raw } = await translate(note.text, { to: targetLang });
const { text, raw } = await translate((note.cw ? note.cw + '\n' : '') + note.text, { to: targetLang });
return {
sourceLang: raw.src,
@ -119,7 +119,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
if (instance.ctav3SaKey == null) { return 204; } else if (instance.ctav3ProjectId == null) { return 204; }
else if (instance.ctav3Location == null) { return 204; }
translationResult = await this.apiCloudTranslationAdvanced(
note.text, targetLang, instance.ctav3SaKey, instance.ctav3ProjectId, instance.ctav3Location, instance.ctav3Model, instance.ctav3Glossary, instance.translatorType,
(note.cw ? note.cw + '\n' : '') + note.text, targetLang, instance.ctav3SaKey, instance.ctav3ProjectId, instance.ctav3Location, instance.ctav3Model, instance.ctav3Glossary, instance.translatorType,
);
} else {
throw new Error('Unsupported translator type');