fix: Split validateActionName (#29243)

This commit is contained in:
Nidhi 2023-11-30 17:41:06 +05:30 committed by GitHub
parent 33151d044d
commit e018db8ec7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -286,7 +286,7 @@ public class NewActionServiceCEImpl extends BaseService<NewActionRepository, New
this.validateCreatorId(action); this.validateCreatorId(action);
if (!entityValidationService.validateName(action.getName())) { if (!isValidActionName(action)) {
action.setIsValid(false); action.setIsValid(false);
invalids.add(AppsmithError.INVALID_ACTION_NAME.getMessage()); invalids.add(AppsmithError.INVALID_ACTION_NAME.getMessage());
} }
@ -415,6 +415,10 @@ public class NewActionServiceCEImpl extends BaseService<NewActionRepository, New
.flatMap(this::setTransientFieldsInUnpublishedAction); .flatMap(this::setTransientFieldsInUnpublishedAction);
} }
protected boolean isValidActionName(ActionDTO action) {
return entityValidationService.validateName(action.getName());
}
protected Mono<ActionDTO> validateCreatorId(ActionDTO action) { protected Mono<ActionDTO> validateCreatorId(ActionDTO action) {
if (action.getPageId() == null || action.getPageId().isBlank()) { if (action.getPageId() == null || action.getPageId().isBlank()) {
throw new AppsmithException(AppsmithError.INVALID_PARAMETER, FieldName.PAGE_ID); throw new AppsmithException(AppsmithError.INVALID_PARAMETER, FieldName.PAGE_ID);