Skip to content

Commit 8272b30

Browse files
[BUGFIX][ADMIN] Afficher la date de création d'un compte seulement quand elle est disponible (PIX-9570)
#7324
2 parents a922408 + 5a07a7c commit 8272b30

File tree

4 files changed

+68
-5
lines changed

4 files changed

+68
-5
lines changed

admin/app/components/users/user-overview.hbs

+6-2
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,12 @@
124124
<li class="user-detail-personal-information-section__user-informations">Nom : {{@user.lastName}}</li>
125125
<li class="user-detail-personal-information-section__user-informations">Langue : {{@user.lang}}</li>
126126
<li class="user-detail-personal-information-section__user-informations">Locale : {{@user.locale}}</li>
127-
<li class="user-detail-personal-information-section__user-informations">Date de création :
128-
{{dayjs-format @user.createdAt "DD/MM/YYYY"}}</li>
127+
<li class="user-detail-personal-information-section__user-informations">
128+
Date de création :
129+
{{#if @user.createdAt}}
130+
{{dayjs-format @user.createdAt "DD/MM/YYYY"}}
131+
{{/if}}
132+
</li>
129133
</ul>
130134
<ul class="user-detail-personal-information-section__infogroup">
131135
<li class="user-detail-personal-information-section__user-informations">Adresse e-mail :

admin/tests/integration/components/users/user-overview_test.js

+26
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,32 @@ module('Integration | Component | users | user-overview', function (hooks) {
6262
assert.dom(screen.getByText('Date de création : 10/12/2021')).exists();
6363
});
6464

65+
test("displays user's information without creation date", async function (assert) {
66+
// given
67+
const store = this.owner.lookup('service:store');
68+
const user = store.createRecord('user', {
69+
firstName: 'John',
70+
lastName: 'Snow',
71+
72+
username: 'kingofthenorth',
73+
lang: 'fr',
74+
locale: 'fr-FR',
75+
});
76+
this.set('user', user);
77+
78+
// when
79+
const screen = await render(hbs`<Users::UserOverview @user={{this.user}} />`);
80+
81+
// then
82+
assert.dom(screen.getByText(`Prénom : ${this.user.firstName}`)).exists();
83+
assert.dom(screen.getByText(`Nom : ${this.user.lastName}`)).exists();
84+
assert.dom(screen.getByText(`Adresse e-mail : ${this.user.email}`)).exists();
85+
assert.dom(screen.getByText(`Identifiant : ${this.user.username}`)).exists();
86+
assert.dom(screen.getByText('Langue : fr')).exists();
87+
assert.dom(screen.getByText('Locale : fr-FR')).exists();
88+
assert.dom(screen.getByText('Date de création :')).exists();
89+
});
90+
6591
module('terms of service', function () {
6692
module('should display yes by application', function () {
6793
test('should display "OUI" with date when user accepted Pix App terms of service', async function (assert) {

api/db/seeds/data/team-acces/build-users.js

+9
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,15 @@ function _buildUsers(databaseBuilder) {
5151
5252
});
5353
databaseBuilder.factory.buildUserLogin({ userId: userWithLastLoggedAt.id, lastLoggedAt: new Date('1970-01-01') });
54+
55+
// User with a specific createdAt
56+
databaseBuilder.factory.buildUser.withRawPassword({
57+
firstName: 'Chrono',
58+
lastName: 'Post',
59+
username: 'chrono.post',
60+
61+
createdAt: new Date('2000-12-31'),
62+
});
5463
}
5564

5665
export function buildUsers(databaseBuilder) {

certif/package-lock.json

+27-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)