You can clone with
Hi all -
Here is what I am experiencing:
A published and publicly visible page - the home page - becomes unpublished. This happens
when a user makes an edit and Saves (or just hits Save), with permissions of "Add" and "Change" to just the home page.
CMS_PUBLIC_FOR = 'all'
CMS_PERMISSION = True
CMS_MODERATOR = True
--(run required command: cms moderator on)
--- Create user with only "Add" and "Change" page permissions
--- Only give this user permissions to edit the home page
3: Login in as that user. Go to the home page in admin. Press "Save". (You don't
need to make a change for the bug to happen. just press "Save"). And you
see the home page is marked as unpublished.
Logout of admin. See that your home page is missing from the the
public all together. It's not in the nav. And the second page underneath
became the new home page.
Login back in as super user, see that the second page just under
the home page is now marked with the tree symbol, as the new home
page. The original first homepage has to be republished to go live.
does this only happen on home pages or all pages?
After more testing I am able to reproduce on all pages.
can you confirm this only happening the first time an underprivileged admin saves the page? If a superuser later publishes it, the other admin can no longer accidentally unpublish it. At least that was the behavior I experienced
I can confirm following behavior (admin with rights as described in OT):
1: superuser creates page (public)
2: admin saves the page
3: page is unpublished
4: superuser publishes page (again)
5: page is published
6: admin saves page
7: page is still published (expected behavior)
The different workflow internally is that line 324 (elif not self.requires_approvement()) triggers in 2, but not in 6. This sets the moderator state to 'MODERATOR_NEED_APPROVEMENT' in the first case, not in the second.
actually those findings were wrong
I now get consistent unpublishing.
The culprit seems to be 370-372 and not what I linked above (see https://github.com/divio/django-cms/blob/develop/cms/models/pagemodel.py#L370-372)
Okay removing those lines solves this issue.
No clue about possible side effects though.
Pull request: #982
On my end any page becomes unpublished every time an underprivileged admin saves the page. So not just the first time the underprivileged admin saves the page.
That worked. I tested the removal of lines 370-372. I can confirm that a page no longer becomes unpublished upon save by underprivileged admin. Thanks.
the big question is, does it have any negative side effects?
fixed in 5f3c331
"the big question is, does it have any negative side effects?"
I know! Unless that was accidentally left over legacy code I imagine it served some purpose. Moderation is important for the client I am working with, so I will continue to test that and the rest of 2.2 thoroughly, and report back any strange findings. I am learning django-cms at the same time so it's a slow process on my end.