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

Variant node name can be changed when choosing audience

    Details

    • Type: Bug
    • Status: Open
    • Priority: Neutral
    • Resolution: Unresolved
    • Affects Version/s: 1.4.5
    • Fix Version/s: None
    • Component/s: Integration, Preview App
    • Labels:
      None

      Description

      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));
                      item.setNodeName(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)

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                miruela Mercedes Iruela
              • Votes:
                3 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Date of First Response: