-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
fix: Page menu disappeared in edit or structure endpoints when refreshing the toolbar #8137
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
Conversation
Reviewer's Guide by SourceryThis PR fixes the issue where the wrong page was detected when getting the toolbar for an endpoint. The changes are implemented by updating the toolbar retrieval logic to correctly handle PageContent instances, adding a dedicated test to validate the behavior, and standardizing string quotes in tests. Sequence diagram for toolbar page detection processsequenceDiagram
actor User
participant ToolbarHandler as get_toolbar()
participant PageFetcher as get_page_from_request()
participant PageContent
User->>ToolbarHandler: Call get_toolbar(request)
alt attached_obj is an instance of PageContent
ToolbarHandler->>PageContent: Retrieve page (attached_obj.page)
else attached_obj is not a PageContent
ToolbarHandler->>PageFetcher: Call get_page_from_request(request, use_path, clean_path)
end
ToolbarHandler->>User: Return toolbar response or error
Sequence diagram for PageContent handling in admin form cleaningsequenceDiagram
participant AdminForm as clean()
participant ModelClass
participant AdminManager
participant ORM
AdminForm->>ModelClass: Determine model_class type
alt model_class is a subclass of PageContent
AdminForm->>AdminManager: admin_manager.select_related("page").get(pk)
else model_class has admin_manager attribute
AdminForm->>AdminManager: admin_manager.get(pk)
else
AdminForm->>ORM: objects.get(pk)
end
AdminForm->>AdminForm: Return generic_obj
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @fsbraun - I've reviewed your changes - here's some feedback:
Overall Comments:
- In get_toolbar, consider adding a fallback or explicit error when attached_obj is provided but isn’t a PageContent instance, so unexpected types are handled clearly.
- In forms.py, ensure model_class is a valid type before using issubclass to avoid potential type errors.
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Let's get this merged and released 🚢 🚀
Description
This PR fixes #8136 and adds a test for it.
Related resources
Checklist
develop-4
Summary by Sourcery
Bug Fixes: