From c6227d329db1a723cd42901c66d4e6b6ff065b2d Mon Sep 17 00:00:00 2001 From: rouxxi Date: Wed, 13 Nov 2024 11:57:22 +0100 Subject: [PATCH] feat(orga): display participant page in sidebar for schools Co-authored-by: Co-authored-by: --- orga/app/components/layout/sidebar.hbs | 14 ++++++-------- orga/app/components/layout/sidebar.js | 4 ---- orga/app/services/current-user.js | 4 ---- .../components/layout/sidebar-test.js | 10 +--------- orga/tests/unit/services/current-user-test.js | 18 ------------------ 5 files changed, 7 insertions(+), 43 deletions(-) diff --git a/orga/app/components/layout/sidebar.hbs b/orga/app/components/layout/sidebar.hbs index 42555f7d115..f10a5a9a5d7 100644 --- a/orga/app/components/layout/sidebar.hbs +++ b/orga/app/components/layout/sidebar.hbs @@ -31,14 +31,12 @@ {{t "navigation.main.missions"}} {{/if}} - {{#if this.shouldDisplayParticipantsEntry}} - - - - - {{t this.organizationLearnersList.label}} - - {{/if}} + + + + + {{t this.organizationLearnersList.label}} + diff --git a/orga/app/components/layout/sidebar.js b/orga/app/components/layout/sidebar.js index e9c9cea1ca7..95c55b9d3b7 100644 --- a/orga/app/components/layout/sidebar.js +++ b/orga/app/components/layout/sidebar.js @@ -33,10 +33,6 @@ export default class SidebarMenu extends Component { return this.currentUser.canAccessCampaignsPage; } - get shouldDisplayParticipantsEntry() { - return this.currentUser.canAccessParticipantsPage; - } - get organizationLearnersList() { if (this.currentUser.isSCOManagingStudents) { return { diff --git a/orga/app/services/current-user.js b/orga/app/services/current-user.js index 91af3b39402..61011aed9ff 100644 --- a/orga/app/services/current-user.js +++ b/orga/app/services/current-user.js @@ -84,10 +84,6 @@ export default class CurrentUserService extends Service { return !this.prescriber.missionsManagement; } - get canAccessParticipantsPage() { - return !this.prescriber.missionsManagement; - } - get hasLearnerImportFeature() { return this.prescriber.hasOrganizationLearnerImport; } diff --git a/orga/tests/integration/components/layout/sidebar-test.js b/orga/tests/integration/components/layout/sidebar-test.js index b6c9af9ed5f..29850fec3ef 100644 --- a/orga/tests/integration/components/layout/sidebar-test.js +++ b/orga/tests/integration/components/layout/sidebar-test.js @@ -56,7 +56,6 @@ module('Integration | Component | Layout::Sidebar', function (hooks) { class CurrentUserStub extends Service { organization = Object.create({ id: '1' }); canAccessCampaignsPage = true; - canAccessParticipantsPage = true; } this.owner.register('service:current-user', CurrentUserStub); const intl = this.owner.lookup('service:intl'); @@ -125,7 +124,6 @@ module('Integration | Component | Layout::Sidebar', function (hooks) { // given class CurrentUserStub extends Service { organization = Object.create({ id: '1', type: 'PRO' }); - canAccessParticipantsPage = true; } this.owner.register('service:current-user', CurrentUserStub); @@ -146,7 +144,6 @@ module('Integration | Component | Layout::Sidebar', function (hooks) { class CurrentUserStub extends Service { organization = Object.create({ id: '1', type: 'SUP' }); isSUPManagingStudents = true; - canAccessParticipantsPage = true; } this.owner.register('service:current-user', CurrentUserStub); @@ -165,7 +162,6 @@ module('Integration | Component | Layout::Sidebar', function (hooks) { class CurrentUserStub extends Service { organization = Object.create({ id: '1', type: 'SUP' }); isSUPManagingStudents = false; - canAccessParticipantsPage = true; } this.owner.register('service:current-user', CurrentUserStub); @@ -187,7 +183,6 @@ module('Integration | Component | Layout::Sidebar', function (hooks) { organization = Object.create({ id: '1', type: 'SCO' }); isSCOManagingStudents = true; canAccessMissionsPage = false; - canAccessParticipantsPage = true; } this.owner.register('service:current-user', CurrentUserStub); @@ -206,7 +201,6 @@ module('Integration | Component | Layout::Sidebar', function (hooks) { class CurrentUserStub extends Service { organization = Object.create({ id: '1', type: 'SCO' }); isSCOManagingStudents = false; - canAccessParticipantsPage = true; } this.owner.register('service:current-user', CurrentUserStub); @@ -306,7 +300,7 @@ module('Integration | Component | Layout::Sidebar', function (hooks) { ); }); - test('should not display Campagne and Participants menus', async function (assert) { + test('should not display Campagne', async function (assert) { class CurrentUserStub extends Service { organization = Object.create({ id: 5 }); canAccessMissionsPage = true; @@ -318,9 +312,7 @@ module('Integration | Component | Layout::Sidebar', function (hooks) { const screen = await render(hbs``); assert.dom(screen.queryByText('Campagnes')).doesNotExist(); - assert.dom(screen.queryByText('Participants')).doesNotExist(); assert.dom(screen.queryByText('Étudiants')).doesNotExist(); - assert.dom(screen.queryByText('Élèves')).doesNotExist(); }); }); diff --git a/orga/tests/unit/services/current-user-test.js b/orga/tests/unit/services/current-user-test.js index b49583a4b8b..17648073253 100644 --- a/orga/tests/unit/services/current-user-test.js +++ b/orga/tests/unit/services/current-user-test.js @@ -338,24 +338,6 @@ module('Unit | Service | current-user', function (hooks) { }); }); - module('#canAccessParticipantsPage', function () { - test('should return false if user has mission feature activated', function (assert) { - currentUserService.prescriber = { - missionsManagement: true, - }; - - assert.false(currentUserService.canAccessParticipantsPage); - }); - - test('should return true if user does not have missions feature activated', function (assert) { - currentUserService.prescriber = { - missionsManagement: false, - }; - - assert.true(currentUserService.canAccessParticipantsPage); - }); - }); - module('#canAccessImportPage', function (hooks) { hooks.beforeEach(function () { currentUserService.prescriber = { hasOrganizationLearnerImport: false };