fix: say in Composing that "Plain text only" also shows received mail as plain text

This commit is contained in:
Linus Rath
2026-10-31 13:49:05 +01:00
parent 9ce89e2672
commit b17d4d4069
2 changed files with 30 additions and 1 deletions
@@ -0,0 +1,26 @@
// "Plain text only" also makes the app show received mail as plain text
// (plain-text-reading.test.ts), but Settings > Composing described it with
// the webmail's text, which only talks about sending.
import { describe, expect, it, vi } from 'vitest';
import fs from 'node:fs';
import path from 'node:path';
vi.mock('expo-localization', () => ({ getLocales: () => [] }));
import { translate } from '../../i18n';
function description(rel: string): string {
const source = fs.readFileSync(path.resolve(__dirname, '..', rel), 'utf8');
const m = /t\('(settings\.email_behavior\.plain_text_mode\.[a-z_]+)', (['"])(.*?)\2\)/.exec(
source.slice(source.indexOf("plain_text_mode.label")),
);
if (!m) throw new Error(`no plain_text_mode description in ${rel}`);
return translate('en', m[1], m[3]);
}
describe('the plain text only setting', () => {
it('mentions reading in Composing as well as in Reading', () => {
expect(description('settings/ComposingSettings.tsx')).toMatch(/\bread\b/i);
expect(description('settings/ReadingSettings.tsx')).toMatch(/\bread\b/i);
});
});
@@ -133,7 +133,10 @@ export function ComposingSettings() {
<SettingItem
label={t('settings.email_behavior.plain_text_mode.label', "Plain Text Only")}
description={t('settings.email_behavior.plain_text_mode.description', "Disable the rich text editor and send all emails as plain text only, including replies and forwards")}
// The app also shows received mail as plain text with this on, which
// the webmail's description (sending only) leaves out; same text as
// under Reading.
description={t('settings.email_behavior.plain_text_mode.description_mobile', 'Compose and read in plain text only.')}
>
<ToggleSwitch checked={plainTextMode} onChange={(v) => updateSetting('plainTextMode', v)} />
</SettingItem>