[ACS-8824] The user cannot edit node properties after failing... (#10420)

* [ACS-8824] The user cannot edit node properties after failing to change node name with special characters

* [ACS-8824] fix formatting
This commit is contained in:
Mykyta Maliarchuk 2024-12-16 12:58:42 +01:00 committed by GitHub
parent 70c59049c9
commit 4ab3040954
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 23 additions and 1 deletions

View File

@ -389,6 +389,27 @@ describe('ContentMetadataComponent', () => {
flush();
}));
it('should revert changes on unsuccessful save', fakeAsync(() => {
component.readOnly = false;
const property = { key: 'properties.property-key', value: 'original-value' } as CardViewBaseItemModel;
spyOn(nodesApiService, 'updateNode').and.returnValue(throwError(new Error('error message')));
spyOn(component, 'revertChanges').and.callThrough();
updateService.update(property, 'new-value');
tick(600);
fixture.detectChanges();
toggleEditModeForGeneralInfo();
tick(100);
clickOnGeneralInfoSave();
tick(100);
expect(component.revertChanges).toHaveBeenCalled();
expect(component.changedProperties).toEqual({});
expect(component.hasMetadataChanged).toBeFalse();
discardPeriodicTasks();
flush();
}));
it('should open the confirm dialog when content type is changed', fakeAsync(() => {
component.readOnly = false;
const property = { key: 'nodeType', value: 'ft:sbiruli' } as CardViewBaseItemModel;

View File

@ -409,6 +409,7 @@ export class ContentMetadataComponent implements OnChanges, OnInit {
this.cardViewContentUpdateService.updateElement(this.targetProperty);
this.handleUpdateError(err);
this._saving = false;
this.revertChanges();
this.loadProperties(this.node);
return of(null);
})

View File

@ -45,7 +45,7 @@ export class BasicPropertiesService {
key: 'properties.cm:name',
editable: true,
validators: [
new CardViewItemMatchValidator('[\\/\\*\\\\"\\\\]')
new CardViewItemMatchValidator('[\\/\\*\\\\"\\\\:]')
]
}),
new CardViewTextItemModel({