Bug #24082
closedhammer content-view purge not deleting unused versions if one is in use by a published view
Description
In this content view, there are 2 versions published in environments, 5 unpublished. One of the 5 unpublished can be removed initially. Then no other versions can be removed because one is in use. Once I delete the version of the composite that is in use, then I am able to proceed. Shouldn't purge be able to remove the unused ones that aren't in published composites?
$ hammer content-view version list --content-view my-el7-cv --organization-id 1
------|-----------------------|---------|-------------------------
ID | NAME | VERSION | LIFECYCLE ENVIRONMENTS
------|-----------------------|---------|-------------------------
15753 | my-el7-cv 2726.0 | 2726.0 | Library, Development, QA
15748 | my-el7-cv 2725.0 | 2725.0 |
15743 | my-el7-cv 2724.0 | 2724.0 |
15736 | my-el7-cv 2722.0 | 2722.0 | Staging, Production
15725 | my-el7-cv 2719.0 | 2719.0 |
15712 | my-el7-cv 2716.0 | 2716.0 |
15563 | my-el7-cv 2683.0 | 2683.0 |
------|-----------------------|---------|-------------------------
$ hammer content-view purge --id 259 --organization-id 1 --count 3
[...............................................................................................................................................................................................] [100%]
Version '2725.0' of content view 'my-el7-cv' deleted.
Cannot delete version while it is in use by composite content views: xxx-comp-cv Version 1494.0
$ hammer content-view version list --content-view my-el7-cv --organization-id 1
------|-----------------------|---------|-------------------------
ID | NAME | VERSION | LIFECYCLE ENVIRONMENTS
------|-----------------------|---------|-------------------------
15753 | my-el7-cv 2726.0 | 2726.0 | Library, Development, QA
15743 | my-el7-cv 2724.0 | 2724.0 |
15736 | my-el7-cv 2722.0 | 2722.0 | Staging, Production
15725 | my-el7-cv 2719.0 | 2719.0 |
15712 | my-el7-cv 2716.0 | 2716.0 |
15563 | my-el7-cv 2683.0 | 2683.0 |
------|-----------------------|---------|-------------------------
$ hammer content-view purge --id 259 --organization-id 1 --count 3
Cannot delete version while it is in use by composite content views: xxx-comp-cv Version 1494.0
$ hammer content-view version list --content-view my-el7-cv --organization-id 1
------|-----------------------|---------|-------------------------
ID | NAME | VERSION | LIFECYCLE ENVIRONMENTS
------|-----------------------|---------|-------------------------
15753 | my-el7-cv 2726.0 | 2726.0 | Library, Development, QA
15743 | my-el7-cv 2724.0 | 2724.0 |
15736 | my-el7-cv 2722.0 | 2722.0 | Staging, Production
15725 | my-el7-cv 2719.0 | 2719.0 |
15712 | my-el7-cv 2716.0 | 2716.0 |
15563 | my-el7-cv 2683.0 | 2683.0 |
------|-----------------------|---------|-------------------------
After I remove xxx-comp-cv Version 1494.0:
$ hammer content-view purge --id 259 --organization-id 1 --count 3
[...............................................................................................................................................................................................] [100%]
Version '2719.0' of content view 'my-el7-cv' deleted.
$ hammer content-view version list --content-view my-el7-cv --organization-id 1
------|-----------------------|---------|-------------------------
ID | NAME | VERSION | LIFECYCLE ENVIRONMENTS
------|-----------------------|---------|-------------------------
15753 | my-el7-cv 2726.0 | 2726.0 | Library, Development, QA
15743 | my-el7-cv 2724.0 | 2724.0 |
15736 | my-el7-cv 2722.0 | 2722.0 | Staging, Production
15712 | my-el7-cv 2716.0 | 2716.0 |
15563 | my-el7-cv 2683.0 | 2683.0 |
------|-----------------------|---------|-------------------------