Skip to content

Commit

Permalink
fix(optional-policies): hide Policies section in user profile when no…
Browse files Browse the repository at this point in the history
… optional policies exist (#60)

* fix(optional-policies): hide Policies section in user profile when no optional policies exist

* refactor(optional-policies): rename `policies` variable to `optionalPolicies` for better clarity
  • Loading branch information
rafaucau authored Nov 23, 2024
1 parent f7cc50b commit 7aa460d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions js/src/forum/components/addManagePoliciesOption.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,17 @@ async function updatePolicy(policy, value) {

export default function () {
extend(SettingsPage.prototype, 'settingsItems', function (items) {
const policies = app.store.all('fof-terms-policies').filter((policy) => policy.optional());
const optionalPolicies = app.store.all('fof-terms-policies').filter((policy) => policy.optional());
if (!optionalPolicies.length) {
return;
}

let policyState = app.session.user.fofTermsPoliciesState();

items.add(
'policies',
<FieldSet label={'Policies'}>
{policies.map((policy) => {
{optionalPolicies.map((policy) => {
const { is_accepted } = policyState[policy.id()];
return (
<div class={'Fof-Terms-Policy-User-Settings-Management'}>
Expand Down

0 comments on commit 7aa460d

Please sign in to comment.