1
0

[CST-5418] Improve notification when cannot deposit

This commit is contained in:
Giuseppe Digilio
2022-04-20 16:10:18 +02:00
parent 3a9d4fad95
commit c250408382
3 changed files with 12 additions and 2 deletions

View File

@@ -884,6 +884,7 @@ describe('SubmissionObjectEffects test suite', () => {
});
expect(submissionObjectEffects.saveAndDeposit$).toBeObservable(expected);
expect(notificationsServiceStub.warning).not.toHaveBeenCalled();
});
it('should return a SAVE_SUBMISSION_FORM_SUCCESS action when there are errors', () => {
@@ -910,10 +911,11 @@ describe('SubmissionObjectEffects test suite', () => {
submissionJsonPatchOperationsServiceStub.jsonPatchByResourceType.and.returnValue(observableOf(response));
const expected = cold('--b-', {
b: new SaveSubmissionFormSuccessAction(submissionId, response as any[])
b: new SaveSubmissionFormSuccessAction(submissionId, response as any[], false)
});
expect(submissionObjectEffects.saveAndDeposit$).toBeObservable(expected);
expect(notificationsServiceStub.warning).toHaveBeenCalled();
});
it('should catch errors and return a SAVE_SUBMISSION_FORM_ERROR', () => {

View File

@@ -215,7 +215,13 @@ export class SubmissionObjectEffects {
if (this.canDeposit(response)) {
return new DepositSubmissionAction(action.payload.submissionId);
} else {
return new SaveSubmissionFormSuccessAction(action.payload.submissionId, response);
this.notificationsService.warning(
null,
this.translate.instant('submission.sections.general.cannot_deposit'),
null,
true
);
return new SaveSubmissionFormSuccessAction(action.payload.submissionId, response, false);
}
}),
catchError(() => observableOf(new SaveSubmissionFormErrorAction(action.payload.submissionId))));

View File

@@ -3828,6 +3828,8 @@
"submission.sections.general.add-more": "Add more",
"submission.sections.general.cannot_deposit": "Deposit cannot be completed due to missing mandatory information.<br>Please add them for final submission.",
"submission.sections.general.collection": "Collection",
"submission.sections.general.deposit_error_notice": "There was an issue when submitting the item, please try again later.",