plone / Products.CMFPlone

The core of the Plone content management system
https://plone.org
GNU General Public License v2.0
240 stars 183 forks source link

Workflow transition on defaultPage is propagated to its container #3932

Closed sauzher closed 2 months ago

sauzher commented 3 months ago

BUG/PROBLEM REPORT (OR OTHER COMMON ISSUE)

What I did:

Step to reproduce on a vanilla plone4, plone5.2 or plone6 classic:

  1. create a folder BAR
  2. create a page BAZ inside BAR
  3. Publish both BAR and BAZ
  4. set BAZ as default page of BAR
  5. Retract publication on page BAZ

What I expect to happen:

What actually happened:

What version of Plone/ Addons I am using:

yurj commented 3 months ago

https://classic.demo.plone.org/en/bar/content_status_modify?workflow_action=retract&_authenticator=xyz this is the link, the bug is in https://github.com/plone/plone.app.layout/blob/master/plone/app/layout/viewlets/toolbar*

But the link does not explain why the page itself change status...

stevepiercy commented 3 months ago

What happens if you put two pages inside a folder, and unpublish only one of the two pages?

sauzher commented 3 months ago

@stevepiercy The issues raises only when the page is set as defaultPage of its container. Only one page at time can be the default.

@yurj the toolbar link is 404. Alas, the plone demo site is automatically reset often to be useful as reference here.

yurj commented 3 months ago

it is 404 because I've deleted the `_authenticator' value. The main part was the link pointing to the folder instead of the page.

I'm thinking it to be a feature:

https://github.com/plone/plone.app.content/blob/2a089344cc5ff99ef6a3be578c88c7c8619b1027/plone/app/content/browser/content_status_modify.py#L129C1-L142C18

        # If this item is the default page in its parent, attempt to publish that
        # too. It may not be possible, of course
        if check_default_page_via_view(context, self.request):
            parent = aq_parent(context)
            try:
                parent_modify_view = getMultiAdapter(
                    (parent, self.request), name="content_status_modify"
                )
                parent_modify_view(
                    workflow_action,
                    comment,
                    effective_date=effective_date,
                    expiration_date=expiration_date,
                )

It is there from many years, still in content_status_modify.cpy script.

stevepiercy commented 3 months ago

I think it's a feature, too. It does not make sense to publish an empty container. If you retract the default view of a container, then the container itself should also be retracted. If you want to have the container remain published, then set another page as the default view.

sauzher commented 3 months ago

There's a discussion for the issue here: https://community.plone.org/t/workflow-transition-on-defaultpage-is-propagated-to-its-container/19318

petschki commented 3 months ago

I would also say this is the expected behavior for defaultPages. Otherwise you can change the folder state only via folder_contents or we have to implement an extra action in the toolbar for the "defaultPageContainerState" which adds extra complexity to the already complex "default page" thinking ...

EDIT: In Volto there are no Folders at all, so the folderish page behaves the same like Classic-UI defaultPage when you change workflow states ... which all in all is more understandable, than the other way IMHO

mauritsvanrees commented 2 months ago

I would also say this is expected behavior. It may have surprised you, but not doing it this way would be more surprising.