when checking the code for get_pages_with_reviews_for_user():
@classmethod
def get_pages_with_reviews_for_user(cls, user):
"""
Return a queryset of pages which have reviews, for which the user has edit permission
"""
user_perms = UserPagePermissionsProxy(user)
reviewed_pages = (
cls.objects
.order_by('-created_at')
.values_list('page_revision__page_id', 'created_at')
)
# Annotate datetime when a review was last created for this page
last_review_requested_at = Case(
*[
When(pk=pk, then=Value(created_at))
for pk, created_at in reviewed_pages
],
output_field=models.DateTimeField(),
)
return (
user_perms.editable_pages()
.filter(pk__in=(page[0] for page in reviewed_pages))
.annotate(last_review_requested_at=last_review_requested_at)
.order_by('-last_review_requested_at')
)
as you remark if we have many pages which is my case this loop is causing problems loading any page in the application with menu_items
to resolve this problem for the moment I was pushed to delete the hook through this command(because hiding the menu_item is not resolving the problem as the hook is always have been called):
sed -i "s/register_admin_menu_item//g" /usr/local/lib/python3.8/site-packages/wagtail_review/wagtail_hooks.py
my question is there any way to cancel showing the menu item with a more proper way?
thank you
the review menu which is being initiated through this code in
wagtail_hooks.py
when checking the code for
get_pages_with_reviews_for_user()
:as you remark if we have many pages which is my case this loop is causing problems loading any page in the application with menu_items to resolve this problem for the moment I was pushed to delete the hook through this command(because hiding the menu_item is not resolving the problem as the hook is always have been called):
my question is there any way to cancel showing the menu item with a more proper way? thank you