diff --git a/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/ce/ActionCE_DTO.java b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/ce/ActionCE_DTO.java index 52b4ea3e73..dcd2639ec3 100644 --- a/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/ce/ActionCE_DTO.java +++ b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/models/ce/ActionCE_DTO.java @@ -25,6 +25,7 @@ import lombok.Setter; import lombok.ToString; import lombok.experimental.FieldNameConstants; import org.springframework.data.annotation.Transient; +import org.springframework.util.StringUtils; import java.time.Instant; import java.util.HashMap; @@ -199,11 +200,11 @@ public class ActionCE_DTO implements Identifiable, Executable { @Override @JsonView({Views.Internal.class}) public String getValidName() { - if (this.fullyQualifiedName == null) { - return this.name; - } else { + if (StringUtils.hasText(this.fullyQualifiedName)) { return this.fullyQualifiedName; } + + return this.name; } @Override diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/importable/NewActionImportableServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/importable/NewActionImportableServiceCEImpl.java index 3d87c2fdcb..3755272f84 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/importable/NewActionImportableServiceCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/newactions/importable/NewActionImportableServiceCEImpl.java @@ -2,6 +2,7 @@ package com.appsmith.server.newactions.importable; import com.appsmith.external.models.ActionDTO; import com.appsmith.external.models.Datasource; +import com.appsmith.external.models.PluginType; import com.appsmith.external.models.Policy; import com.appsmith.server.actioncollections.base.ActionCollectionService; import com.appsmith.server.constants.FieldName; @@ -482,11 +483,17 @@ public class NewActionImportableServiceCEImpl implements ImportableServiceCE newActionService.generateActionByViewMode(branchedAction, false)) .flatMap(action -> { action.setName(refactorEntityNameDTO.getNewName()); - if (StringUtils.hasLength(refactorEntityNameDTO.getCollectionName())) { + if (!PluginType.JS.equals(action.getPluginType())) { + return newActionService.updateUnpublishedAction(action.getId(), action); + } + + if (StringUtils.hasText(refactorEntityNameDTO.getCollectionName())) { action.setFullyQualifiedName(refactorEntityNameDTO.getNewFullyQualifiedName()); } + return newActionService.updateUnpublishedAction(action.getId(), action); }) .then();