Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add new pages to sidebar after patch approval #247

Merged
merged 3 commits into from
Jun 12, 2024

Conversation

mgiadach
Copy link
Contributor

@mgiadach mgiadach commented Jun 3, 2024

This PR addresses issue #244 (refer to the full description there).

Problem

New Wiki Pages can be published in two distinct ways: (i) immediately, if the creator holds the Wiki Approver role; or (ii) pending manual approval of the associated Wiki Page Patch if the creator lacks the Wiki Approver role.

The logic for this is embedded in the whitelisted update function within the wiki/doctype/wiki_report/wiki_report.py file. This function checks if the user possesses the submit perm for that doctype to determine whether to submit it immediately or not. There is an issue within this function: it expects to receive the new_sidebar_items argument from the API call, and subsequently stores it (at runtime) in the Wiki Page Patch object. However, this doctype lacks a corresponding field, thus the information is not persisted in the database. Consequently, when the doctype is not immediately submitted, this information is lost, preventing its later use in updating the sidebar.

Solution

In my opinion, there is a design flaw in how sidebar updates are currently managed. Nevertheless, I have chosen not to alter the existing mechanism within this PR (such a refactor could be pursued in a following PR). My solution leverages the new_sidebar_group property (an existing property of the doctype) to compute the position in the sidebar and to update it when the new_sidebar_items property is not present (preserving the original behavior).

@mgiadach
Copy link
Contributor Author

mgiadach commented Jun 5, 2024

Hi @BreadGenie @rmehta , could you please review this when you have a chance? Thank you for your time!

@mgiadach
Copy link
Contributor Author

Hi @BreadGenie , just a friendly reminder to check this PR. In my opinion, it fixes a very annoying bug in wikis with many contributors that require approvals to publish new pages.

@rmehta rmehta merged commit 5976585 into frappe:master Jun 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants