Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Register
  • Sign in
  • erp5 erp5
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Merge requests 142
    • Merge requests 142
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Jobs
  • Commits
Collapse sidebar
  • nexedinexedi
  • erp5erp5
  • Merge requests
  • !664

Category self membership after move and clone

  • Review changes

  • Download
  • Patches
  • Plain diff
Merged Jérome Perrin requested to merge jerome/erp5:fix/category_self_membership_after_move_and_clone into master May 09, 2018
  • Overview 14
  • Commits 4
  • Pipelines 0
  • Changes 4

Categories are member of themselves. When a category is renamed, the membership to self was already preserved thanks to https://lab.nexedi.com/nexedi/erp5/commit/7f2e8eb26a3f856d0dd8fa022700f0581080ed8f , but this was not the case when a category was cut and pasted.

There are two different cases:

  • When just created, a category is member of itself because this is the default behavior for categories not having categories set. In this case, it's dynamic.
  • When category has some categories set ( in self.categories ) - this happens for example after being renamed - then behavior is different and self.categories has to be updated.

7f2e8eb2 was handling properly the later case after a clone, but not in a cut and paste ( move ) scenario, because in this case "after clone" hook is not called.

The first idea was to move the same hook at another level by overloading _postCopy but after some discussion and thinking, it seemed more logical to make sure CategoryTool.setCategoryList does not save categories membership to self, which is consistent in the way CategoryTool.getCategoryList adds the membership to self dynamically.

This MR brings a few more tests, so that we can claim #1900 and #704 are tested enough and close these old bugs.

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: fix/category_self_membership_after_move_and_clone
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7