Skip to content

Commit 31631ae

Browse files
refactor: inline syncSubPreferences into master change handler
The syncSubPreferences helper was only invoked from the master checkbox's change handler (disable branch) and never on init, where initial visibility is already set server-side via Jinja. Inlining it removes the indirection and the asymmetry between the enable and disable paths while preserving behavior: enabling reveals the sub-preferences and checks updates; disabling hides them and clears both sub-preferences. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent f64999e commit 31631ae

1 file changed

Lines changed: 2 additions & 10 deletions

File tree

templates/partials/communication_preferences_fields.html

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,23 +54,15 @@
5454
return;
5555
}
5656

57-
function syncSubPreferences() {
57+
master.addEventListener('change', function () {
5858
if (master.checked) {
5959
subPrefs.style.display = '';
60+
updates.checked = true;
6061
} else {
6162
subPrefs.style.display = 'none';
6263
updates.checked = false;
6364
marketing.checked = false;
6465
}
65-
}
66-
67-
master.addEventListener('change', function () {
68-
if (master.checked) {
69-
subPrefs.style.display = '';
70-
updates.checked = true;
71-
} else {
72-
syncSubPreferences();
73-
}
7466
});
7567
});
7668
})();

0 commit comments

Comments
 (0)