Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-23170

"swap node" function can swap container and non-container nodes (invalid state)

    Details

      Description

      The 'Swap with another node' function in the administration interface swaps two nodes (not subtrees).

      When one of the objects (A) is a container, with children, and the other (B) is not, the result will be an incoherent state:
      B will display a children count such as " Sub items ", but instead of the children will show the message "The <ClassName> class is not configured to contain any sub items."

      Steps to reproduce:
      • Create or modify a class, and uncheck the "Container" checkbox.
      • Create a new object of this type (NodeA)
      • Create a Folder object (NodeB), and add at least one child node to it.
      • Swap NodeA with NodeB using the node's cogwheel > Advanced > Swap with another node.

      Verify that NodeA should not have any children (not container) but does display a Sub Item count.

      Note:

      Its possible the same issue may be triggered from a script, for example; in which case the solution should ideally contemplate it as well.

        Activity

        Hide
        Gunnstein Lye added a comment -

        Ref. Joao's pull request https://github.com/ezsystems/ezpublish-legacy/pull/1032
        I tried to find a way to prevent this in the UI, i.e. make nodes unselectable when they are affected by this problem, but didn't see a way that didn't require a large rewrite (eZContentBrowse::browse() doesn't allow this kind of customisation). And I don't think this somewhat obscure issue is worth a major rewrite. The error/warning in the proposed PR should be enough.

        Show
        Gunnstein Lye added a comment - Ref. Joao's pull request https://github.com/ezsystems/ezpublish-legacy/pull/1032 I tried to find a way to prevent this in the UI, i.e. make nodes unselectable when they are affected by this problem, but didn't see a way that didn't require a large rewrite (eZContentBrowse::browse() doesn't allow this kind of customisation). And I don't think this somewhat obscure issue is worth a major rewrite. The error/warning in the proposed PR should be enough.
        Hide
        Gunnstein Lye added a comment -

        Attached a way to make nodes unselectable when they are affected by this problem. This modifies template code only, so will have to be redone if the admin templates are overridden.

        Show
        Gunnstein Lye added a comment - Attached a way to make nodes unselectable when they are affected by this problem. This modifies template code only, so will have to be redone if the admin templates are overridden.
        Hide
        Gunnstein Lye added a comment -

        Attached v2 of the template fix, same functionality but a little easier to read since it does not modify the original if statement.

        Show
        Gunnstein Lye added a comment - Attached v2 of the template fix, same functionality but a little easier to read since it does not modify the original if statement.
        Show
        Gunnstein Lye added a comment - Merged Joao's PR into master: https://github.com/ezsystems/ezpublish-legacy/commit/dd3d96a2f6d7c493705627f5f30f54b9dce335f7
        Hide
        Paulo Nunes (Inactive) added a comment -

        QA Approved

        Tested on eZ Publish 4.7, 5.0, 5.1, 5.2, 5.3 and master

        Show
        Paulo Nunes (Inactive) added a comment - QA Approved Tested on eZ Publish 4.7, 5.0, 5.1, 5.2, 5.3 and master

          People

          • Assignee:
            Unassigned
            Reporter:
            Joao Inacio (Inactive)
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - Not Specified
              Not Specified
              Remaining:
              Remaining Estimate - 0 minutes
              0m
              Logged:
              Time Spent - 1 day, 4 hours
              1d 4h