Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
get_previous/next_filtered_sibling not considering site or draft status #985
We're using moderation, so publishing was initiated by a call to the approve_page view.
I noticed that Page.get_previous_filtered_sibling, which is called by Page._publisher_save_public while publishing the new public version, is not considering the site nor the draft status.
Starting from Page._publisher_save_public:
The queryset get_previous_filtered_sibling uses to get the sibling (in case of a root node) is:
At least in my case, self._tree_manager is not filtering any pages, so the first item in the final result could belong to any site and/or be a draft page.
In my case the draft home page is on tree_id 1, the current published home page on tree_id 2, and get_previous_filtered_sibling for the published home page returns the draft version.
Going on with the code, since this condition is not True (it should be)
the following code is triggered:
get_next_filtered_sibling is also not filtering on site and status, so in my case it just returns the published home page (tree_id 2) when called on the draft home page (tree_id 1). This means next_sibling.publisher_public is None, so obj (the next public home page) gets assigned the next tree_id and finishes last.
This comment has been minimized.
This comment has been minimized.Show comment Hide comment
OK. There's nothing wrong with get_*_filtered_sibling, but I think parameters are missing from most calls in Page._publisher_save_public
IMO there should also be a filter on the site: