mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 18:14:17 +00:00
[CST-5418] Improve notification when cannot deposit
This commit is contained in:
@@ -884,6 +884,7 @@ describe('SubmissionObjectEffects test suite', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
expect(submissionObjectEffects.saveAndDeposit$).toBeObservable(expected);
|
expect(submissionObjectEffects.saveAndDeposit$).toBeObservable(expected);
|
||||||
|
expect(notificationsServiceStub.warning).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return a SAVE_SUBMISSION_FORM_SUCCESS action when there are errors', () => {
|
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));
|
submissionJsonPatchOperationsServiceStub.jsonPatchByResourceType.and.returnValue(observableOf(response));
|
||||||
|
|
||||||
const expected = cold('--b-', {
|
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(submissionObjectEffects.saveAndDeposit$).toBeObservable(expected);
|
||||||
|
expect(notificationsServiceStub.warning).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should catch errors and return a SAVE_SUBMISSION_FORM_ERROR', () => {
|
it('should catch errors and return a SAVE_SUBMISSION_FORM_ERROR', () => {
|
||||||
|
@@ -215,7 +215,13 @@ export class SubmissionObjectEffects {
|
|||||||
if (this.canDeposit(response)) {
|
if (this.canDeposit(response)) {
|
||||||
return new DepositSubmissionAction(action.payload.submissionId);
|
return new DepositSubmissionAction(action.payload.submissionId);
|
||||||
} else {
|
} 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))));
|
catchError(() => observableOf(new SaveSubmissionFormErrorAction(action.payload.submissionId))));
|
||||||
|
@@ -3828,6 +3828,8 @@
|
|||||||
|
|
||||||
"submission.sections.general.add-more": "Add more",
|
"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.collection": "Collection",
|
||||||
|
|
||||||
"submission.sections.general.deposit_error_notice": "There was an issue when submitting the item, please try again later.",
|
"submission.sections.general.deposit_error_notice": "There was an issue when submitting the item, please try again later.",
|
||||||
|
Reference in New Issue
Block a user