[ADF-4522] Metadata value is not rolled back upon error (#5545)

This commit is contained in:
dhrn 2020-03-13 21:12:38 +05:30 committed by GitHub
parent 22d2a52f68
commit 41597e271a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View File

@ -147,10 +147,12 @@ describe('ContentMetadataComponent', () => {
expect(logService.error).toHaveBeenCalledWith(new Error('My bad')); expect(logService.error).toHaveBeenCalledWith(new Error('My bad'));
}); });
it('should raise error message', (done) => { it('should raise error message and reload the properties', (done) => {
spyOn(contentMetadataService, 'getBasicProperties');
const property = <CardViewBaseItemModel> { key: 'property-key', value: 'original-value' }; const property = <CardViewBaseItemModel> { key: 'property-key', value: 'original-value' };
const sub = contentMetadataService.error.subscribe((err) => { const sub = contentMetadataService.error.subscribe((err) => {
expect(contentMetadataService.getBasicProperties).toHaveBeenCalledWith(node);
expect(err.statusCode).toBe(0); expect(err.statusCode).toBe(0);
expect(err.message).toBe('METADATA.ERRORS.GENERIC'); expect(err.message).toBe('METADATA.ERRORS.GENERIC');
sub.unsubscribe(); sub.unsubscribe();

View File

@ -94,6 +94,7 @@ export class ContentMetadataComponent implements OnChanges, OnInit, OnDestroy {
switchMap((changes) => switchMap((changes) =>
this.saveNode(changes).pipe( this.saveNode(changes).pipe(
catchError((err) => { catchError((err) => {
this.loadProperties(this.node);
this.handleUpdateError(err); this.handleUpdateError(err);
return of(null); return of(null);
}) })