Uploaded image for project: 'Magnolia Personalization'
  1. Magnolia Personalization
  2. MGNLPN-396

Variant node name can be changed when choosing audience


      If a page template has the property named name and a variant of this page is created when the audience of the variant is selected. The variant node name is updated to the name defined in property name. It is done in info.magnolia.ui.dialog.action.SaveDialogAction

           * Set the node Name.
           * Node name is set to: <br>
           * the value of the property 'name' if it is present.
          protected void setNodeName(Node node, JcrNodeAdapter item) throws RepositoryException {
              String propertyName = "name";
              if (node.hasProperty(propertyName) && !node.hasProperty(ModelConstants.JCR_NAME)) {
                  Property property = node.getProperty(propertyName);
                  String newNodeName = property.getString();
                  if (!node.getName().equals(Path.getValidatedLabel(newNodeName))) {
                      newNodeName = Path.getUniqueLabel(node.getSession(), node.getParent().getPath(), Path.getValidatedLabel(newNodeName));
                      NodeUtil.renameNode(node, newNodeName);

      This issue makes the variant node has the same name as the parent node, instead of the expected "variant-x". This issue is causing issues with variants logic, for example, if you try to Preview the variant as visitor, an infinite loop is executed.

      You can find more information in linked support ticket. In this case the loop was caused by cmsfn.siteRoot(content)

        Acceptance criteria

              Unassigned Unassigned
              miruela Mercedes Iruela
              3 Vote for this issue
              7 Start watching this issue


                  Bug DoR
                  Task DoD