diff --git a/src/components/ThreadEnvelope.vue b/src/components/ThreadEnvelope.vue index d0624e29f5..4492acbdff 100644 --- a/src/components/ThreadEnvelope.vue +++ b/src/components/ThreadEnvelope.vue @@ -880,9 +880,8 @@ export default { }) }, async handleHtmlBodyMessages() { - console.log('message', this.message) - if (this.message.isHtml) { - const message = await getPlainText(this.message.id) + if (this.message.hasHtmlBody) { + const message = await getPlainText(this.message.databaseId) this.plainTextBody = message.body } else { this.plainTextBody = this.message.body diff --git a/src/components/TranslationModal.vue b/src/components/TranslationModal.vue index 2fa325b167..d23be84f50 100644 --- a/src/components/TranslationModal.vue +++ b/src/components/TranslationModal.vue @@ -187,8 +187,6 @@ export default { }, async mounted() { - await this.handleHtmlBodyMessages() - this.selectedTo = this.optionsTo.find(language => language.id === this.userLanguage) || null if (this.selectedTo) { @@ -204,6 +202,11 @@ export default { methods: { t, handleTranslate() { + if (!this.selectedFrom || !this.selectedTo) { + showError(t('mail', 'Please select languages to translate to and from')) + return + } + this.translateMessage(this.selectedFrom?.id) }, diff --git a/src/service/plainTextService.js b/src/service/plainTextService.js index 6a500d8a45..87f85d821a 100644 --- a/src/service/plainTextService.js +++ b/src/service/plainTextService.js @@ -8,12 +8,13 @@ import { generateUrl } from '@nextcloud/router' import { convertAxiosError } from '../errors/convert.js' export async function getPlainText(id) { - const url = generateUrl('/apps/mail/api/messages', { + const url = generateUrl('/apps/mail/api/messages/{id}/body?plain=true', { id, - plain: true, }) - return await axios.get(url).catch((error) => { + const response = await axios.get(url).catch((error) => { throw convertAxiosError(error) }) + + return response.data }