Skip to content

Commit

Permalink
feat(admin): remove CGU information from overview component
Browse files Browse the repository at this point in the history
  • Loading branch information
EmmanuelleBonnemay committed Dec 5, 2024
1 parent e9b18db commit ca76e7b
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 109 deletions.
32 changes: 1 addition & 31 deletions admin/app/components/users/user-overview.gjs
Original file line number Diff line number Diff line change
Expand Up @@ -64,24 +64,6 @@ export default class UserOverview extends Component {
return false;
}

get userHasValidatePixAppTermsOfService() {
return this._formatValidatedTermsOfServiceText(this.args.user.lastTermsOfServiceValidatedAt, this.args.user.cgu);
}

get userHasValidatePixOrgaTermsOfService() {
return this._formatValidatedTermsOfServiceText(
this.args.user.lastPixOrgaTermsOfServiceValidatedAt,
this.args.user.pixOrgaTermsOfServiceAccepted,
);
}

get userHasValidatePixCertifTermsOfService() {
return this._formatValidatedTermsOfServiceText(
this.args.user.lastPixCertifTermsOfServiceValidatedAt,
this.args.user.pixCertifTermsOfServiceAccepted,
);
}

get languageOptions() {
return this.languages;
}
Expand All @@ -95,11 +77,6 @@ export default class UserOverview extends Component {
return hasBeenAnonymised || isPixAgent;
}

_formatValidatedTermsOfServiceText(date, hasValidatedTermsOfService) {
const formattedDateText = date ? `, le ${dayjs(date).format('DD/MM/YYYY')}` : '';
return hasValidatedTermsOfService ? `OUI${formattedDateText}` : 'NON';
}

_initForm() {
this.form.firstName = this.args.user.firstName;
this.form.lastName = this.args.user.lastName;
Expand Down Expand Up @@ -343,14 +320,7 @@ export default class UserOverview extends Component {
</span>
</li>
</ul>
<ul class="user-detail-personal-information-section__infogroup">
<li class="user-detail-personal-information-section__user-informations">CGU Pix App validé :
{{this.userHasValidatePixAppTermsOfService}}</li>
<li class="user-detail-personal-information-section__user-informations">CGU Pix Orga validé :
{{this.userHasValidatePixOrgaTermsOfService}}</li>
<li class="user-detail-personal-information-section__user-informations">CGU Pix Certif validé :
{{this.userHasValidatePixCertifTermsOfService}}</li>
</ul>

<ul class="user-detail-personal-information-section__infogroup">
<li class="user-detail-personal-information-section__user-informations">Nombre de tentatives de
connexion en erreur :
Expand Down
78 changes: 0 additions & 78 deletions admin/tests/integration/components/users/user-overview-test.gjs
Original file line number Diff line number Diff line change
Expand Up @@ -257,84 +257,6 @@ module('Integration | Component | users | user-overview', function (hooks) {
});
});

module('terms of service', function () {
module('displays yes by application', function () {
test('displays "OUI" with date when user accepted Pix App terms of service', async function (assert) {
// given
const user = { cgu: true, lastTermsOfServiceValidatedAt: new Date('2021-12-10') };

// when
const screen = await render(<template><UserOverview @user={{user}} /></template>);

// then
assert.dom(screen.getByText('CGU Pix App validé : OUI, le 10/12/2021')).exists();
});

test('displays "OUI" with date when user accepted Pix Orga terms of service', async function (assert) {
// given
const user = {
pixOrgaTermsOfServiceAccepted: true,
lastPixOrgaTermsOfServiceValidatedAt: new Date('2021-12-14'),
};

// when
const screen = await render(<template><UserOverview @user={{user}} /></template>);

// then
assert.dom(screen.getByText('CGU Pix Orga validé : OUI, le 14/12/2021')).exists();
});

test('displays "OUI" with date when user accepted Pix Certif terms of service', async function (assert) {
// given
const user = {
pixCertifTermsOfServiceAccepted: true,
lastPixCertifTermsOfServiceValidatedAt: new Date('2021-12-14'),
};

// when
const screen = await render(<template><UserOverview @user={{user}} /></template>);

// then
assert.dom(screen.getByText('CGU Pix Certif validé : OUI, le 14/12/2021')).exists();
});
});

test('displays "NON" when user not accepted Pix App terms of service', async function (assert) {
// given
const user = { pixCertifTermsOfServiceAccepted: true, pixOrgaTermsOfServiceAccepted: true, cgu: false };

// when
const screen = await render(<template><UserOverview @user={{user}} /></template>);

// then
assert.dom(screen.getByText('CGU Pix App validé : NON')).exists();
});

test('displays "NON" when user not accepted Pix Orga terms of service', async function (assert) {
// given
const user = { pixCertifTermsOfServiceAccepted: true, pixOrgaTermsOfServiceAccepted: false, cgu: true };

// when
const screen = await render(<template><UserOverview @user={{user}} /></template>);

// then
assert.dom(screen.getByText('CGU Pix Orga validé : NON')).exists();
});

test('displays "NON" when user not accepted Pix Certif terms of service and "OUI" with no date when terms of service for an app are validated but no date provided', async function (assert) {
// given
const user = { pixCertifTermsOfServiceAccepted: false, pixOrgaTermsOfServiceAccepted: true, cgu: true };

// when
const screen = await render(<template><UserOverview @user={{user}} /></template>);

// then
assert.dom(screen.getByText('CGU Pix Certif validé : NON')).exists();
assert.dom(screen.getByText('CGU Pix Orga validé : OUI')).exists();
assert.dom(screen.getByText('CGU Pix App validé : OUI')).exists();
});
});

module('login information', function (hooks) {
let clock;
const now = new Date('2022-11-28T12:00:00Z');
Expand Down

0 comments on commit ca76e7b

Please sign in to comment.