From 37c9cbfd2caeb1c4532a2329530bc8cd5f48bb08 Mon Sep 17 00:00:00 2001 From: StyxX65 <150797939+StyxX65@users.noreply.github.com> Date: Mon, 28 Sep 2026 10:15:36 +0200 Subject: [PATCH] Fix selecting a profile ticking every M365-only and GWS-only user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit _applyPendingProfileUsers() set u.selected = matches(u), where matches() was `wanted.has(u.id) || (u.googleEmail && ...)`. For users without a googleEmail (every M365-only and Google-only user) that evaluates to undefined, not false — and both renderAccountList() and getSelectedUsers() treat anything other than false as selected. So applying a profile ticked, and would have scanned, all of those users in addition to the profile's own. Coerce the googleEmail branch to a boolean. Reproduced against a copy of real data: a 1-account profile ticked 56 (37 M365-only + 18 GWS-only extras); after the fix it ticks 1, and every profile ticks only its own stored accounts. Regression from bbe9c62 (released in 1.7.10). Co-Authored-By: Claude Opus 5.5 --- static/js/profiles.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/static/js/profiles.js b/static/js/profiles.js index 87e1e94..f507cd5 100644 --- a/static/js/profiles.js +++ b/static/js/profiles.js @@ -238,7 +238,10 @@ function _applyPendingProfileUsers() { if (!ids || !ids.length || !S._allUsers.length) return; const wanted = new Set(ids); // A saved google: may since have merged onto an M365 user (platform 'both') - const matches = u => wanted.has(u.id) || (u.googleEmail && wanted.has('google:' + u.googleEmail)); + // Must return a real boolean: the sidebar and getSelectedUsers() treat any + // selected value other than `false` as ticked, so an `undefined` here (users + // without googleEmail) ticked — and scanned — every M365-only/GWS-only user. + const matches = u => wanted.has(u.id) || !!(u.googleEmail && wanted.has('google:' + u.googleEmail)); S._allUsers.forEach(u => { u.selected = matches(u); }); renderAccountList(); const found = S._allUsers.filter(matches).length;