diff --git a/js/src/forum/components/AcceptPoliciesModal.js b/js/src/forum/components/AcceptPoliciesModal.js index e9e409b..2b59660 100644 --- a/js/src/forum/components/AcceptPoliciesModal.js +++ b/js/src/forum/components/AcceptPoliciesModal.js @@ -10,7 +10,9 @@ export default class AcceptPoliciesModal extends Modal { super.oninit(vnode); app.store.all('fof-terms-policies').forEach((policy) => { - this[policy.form_key()] = false; + const state = app.session.user.fofTermsPoliciesState()[policy.id()]; + // For optional policies, maintain current acceptance status + this[policy.form_key()] = policy.optional() ? state?.is_accepted || false : false; }); } diff --git a/js/src/forum/components/UpdateAlert.tsx b/js/src/forum/components/UpdateAlert.tsx index 8f938a9..1a2e648 100644 --- a/js/src/forum/components/UpdateAlert.tsx +++ b/js/src/forum/components/UpdateAlert.tsx @@ -14,13 +14,20 @@ export default class UpdateAlert { return false; } - const user = app.session.user; + const { user } = app.session; return user && user.fofTermsPoliciesHasUpdate(); } + hasOnlyOptionalUpdates() { + const { user } = app.session; + return user && !user.fofTermsPoliciesMustAccept() && user.fofTermsPoliciesHasUpdate(); + } + view() { - if (!this.shouldShowAlert() || !app.session.user) { + const { user } = app.session; + + if (!this.shouldShowAlert() || !user) { return null; } @@ -37,7 +44,7 @@ export default class UpdateAlert { const dismissControl = []; - if (!app.session.user.fofTermsPoliciesMustAccept()) { + if (!user.fofTermsPoliciesMustAccept()) { dismissControl.push(