Skip to content

Commit

Permalink
Permit to receive mail for not notified state in UI (#7564)
Browse files Browse the repository at this point in the history
Signed-off-by: vlo-rte <[email protected]>
  • Loading branch information
vlo-rte committed Nov 25, 2024
1 parent f626042 commit 2ec604f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ export default class CardsRoutingUtilities {
userWithPerimeters,
card.process,
perim.state as string
) &&
CardsRoutingUtilities.checkFilteringNotification(userWithPerimeters, card.process, perim)
)
);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ describe('Card routing', function () {
currentUserWithReceiveAndWriteRightWithFilteringNotification,
card
)
).toBeFalsy();
).toBeTruthy();
expect(
CardsRoutingUtilities.shouldUserReceiveTheCard(
currentUserWithReceiveAndWriteRightWithFilteringNotificationNotForProcessState,
Expand All @@ -392,7 +392,7 @@ describe('Card routing', function () {
expect(CardsRoutingUtilities.shouldUserReceiveTheCard(currentUserWithReceiveRight, card)).toBeTruthy();
expect(
CardsRoutingUtilities.shouldUserReceiveTheCard(currentUserWithReceiveRightWithFilteringNotification, card)
).toBeFalsy();
).toBeTruthy();
expect(
CardsRoutingUtilities.shouldUserReceiveTheCard(
currentUserWithReceiveRightWithFilteringNotificationNotForProcessState,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -338,10 +338,10 @@ describe('Notification configuration view - User interaction ', () => {
notificationConfigurationView.clickOnStateNotificationByEmail('process1', 'state1_1');
expect(emailEnabledActivated).toEqual('p:process1,s:state1_1,v:false;');
});
it('should not set state notification by email if notification is not set for state', async () => {
it('should set state notification by email even if notification is not set for state', async () => {
notificationConfigurationView.clickOnState('process1', 'state1_2');
notificationConfigurationView.clickOnStateNotificationByEmail('process1', 'state1_2');
expect(emailEnabledActivated).toEqual('');
expect(emailEnabledActivated).toEqual('p:process1,s:state1_2,v:true;');
});
});
describe('User click on save button', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,11 +266,14 @@ export class NotificationConfigurationView {

public clickOnStateNotificationByEmail(processId: string, stateId: string): void {
const process = this.processList.find(({id}) => id === processId);
if (!process) return;
if (!process) {
return;
}

const state = process.states.find(({id}) => id === stateId);
if (!state) return;
if (!state.checked) return;
if (!state) {
return;
}
state.notificationByEmail = !state.notificationByEmail;
this.setEmailEnabled(processId, stateId, state.notificationByEmail);
}
Expand Down

0 comments on commit 2ec604f

Please sign in to comment.