improved _initSummary to chedk the summarize pref. changed summarize_auto, now defaults to 1. see #580

This commit is contained in:
mic 2026-03-26 00:09:06 +01:00
parent fadae81328
commit 0d51829c8e
3 changed files with 6 additions and 4 deletions

View file

@ -95,7 +95,7 @@ These are generated programmatically at the bottom of `mzta-options-default.js`
| `spamfilter_enabled_accounts` | `[]` | Accounts where spam filter is active |
| `spamfilter_show_msg_panel` | `true` | Show info panel on spam detection |
| `summarize` | `false` | Enable email summarization |
| `summarize_auto` | `0` | Auto-summarize mode: `0` = disabled, `1` = manual (show "click to generate" button), `2` = automatic (generate on message open) |
| `summarize_auto` | `1` | Auto-summarize mode: `0` = disabled, `1` = manual (show "click to generate" button), `2` = automatic (generate on message open) |
| `summarize_display_mode` | `'inline'` | Where to display summaries: `'inline'` = message pane banner, `'webchat'` = AI chat window. Note: `summarize_auto = 2` always uses inline regardless of this setting. |
| `summarize_max_display_length` | `0` | Maximum characters shown in inline summary before truncation. `0` = no limit (show full text). When set, text is truncated at a word boundary and a "See more"/"See less" toggle link is shown. |

View file

@ -220,7 +220,9 @@ messenger.runtime.onMessage.addListener((message, sender, sendResponse) => {
async function _initSummary() {
try {
let tabId = sender.tab.id;
let prefs = await browser.storage.sync.get({ summarize_auto: prefs_default.summarize_auto, summarize_display_mode: prefs_default.summarize_display_mode, summarize_max_display_length: prefs_default.summarize_max_display_length });
let prefs = await browser.storage.sync.get({ summarize: prefs_default.summarize, summarize_auto: prefs_default.summarize_auto, summarize_display_mode: prefs_default.summarize_display_mode, summarize_max_display_length: prefs_default.summarize_max_display_length });
if (!prefs.summarize) return;
let message = await browser.messageDisplay.getDisplayedMessage(tabId);
if (!message) return;

View file

@ -137,10 +137,10 @@ export const prefs_default = {
spamfilter: false,
spamfilter_threshold: 70,
spamfilter_enabled_accounts: [],
summarize_auto: 0, // 0: disabled, 1: manual button, 2: automatic
summarize: false,
summarize_auto: 1, // 0: disabled, 1: manual button, 2: automatic
summarize_display_mode: 'inline', // 'inline' or 'webchat'
summarize_max_display_length: 0, // 0 = no limit, otherwise max chars shown inline
spamfilter_show_msg_panel: true,
summarize: false,
...generated_prefs
}