Repository: wagtail/wagtail
File: wagtail/admin/ui/side_panels.py (Python)

Code before:
        context["usage_url_text"] = ngettext(
            "Referenced %(count)s time",
            "Referenced %(count)s times",
            context["usage_count"],
        ) % {"count": context["usage_count"]}
        return context

    def get_context_data(self, parent_context):
        context = super().get_context_data(parent_context)
        page = self.object

        if page.id:
            context.update(
                {
                    "workflow_history_url": reverse(
                        "wagtailadmin_pages:workflow_history", args=(page.id,)
                    ),
                    "revisions_compare_url_name": "wagtailadmin_pages:revisions_compare",
                    "lock_url": reverse("wagtailadmin_pages:lock", args=(page.id,)),
                    "unlock_url": reverse("wagtailadmin_pages:unlock", args=(page.id,)),
                }
            )
        else:
            # set is_public context for new pages based on parent page settings and default privacy setting
            # this gets set in the template if the page is not new
            if page.get_default_privacy_setting(self.request)["type"] != "none":
                context.update({"is_public": False})
            else:
                context.update(
                    {
                        "is_public": Page.objects.filter(id=self.parent_page.id)
                        .public()
                        .exists()
                    }
                )

        context.update(
            {
                "model_name": self.model.get_verbose_name(),
                "base_model_name": Page._meta.verbose_name,
                "model_description": self.model.get_page_description(),
                "status_templates": self.get_status_templates(context),
            }
        )

        return context


class CommentsSidePanel(BaseSidePanel):
    class SidePanelToggle(BaseSidePanel.SidePanelToggle):
        aria_label = gettext_lazy("Toggle comments")

Review comment (suggestion):
```suggestion
            if page.get_default_privacy_setting(self.request)["type"] != BaseViewRestriction.NONE:
```

Code after:
        context = super().get_usage_context()
        context["usage_url_text"] = ngettext(
            "Referenced %(count)s time",
            "Referenced %(count)s times",
            context["usage_count"],
        ) % {"count": context["usage_count"]}
        return context

    def get_context_data(self, parent_context):
        context = super().get_context_data(parent_context)
        page = self.object

        if page.id:
            context.update(
                {
                    "workflow_history_url": reverse(
                        "wagtailadmin_pages:workflow_history", args=(page.id,)
                    ),
                    "revisions_compare_url_name": "wagtailadmin_pages:revisions_compare",
                    "lock_url": reverse("wagtailadmin_pages:lock", args=(page.id,)),
                    "unlock_url": reverse("wagtailadmin_pages:unlock", args=(page.id,)),
                }
            )
        else:
            # set is_public context for new pages based on parent page settings and default privacy setting
            # this gets set in the template if the page is not new
            if (
                page.get_default_privacy_setting(self.request)["type"]
                != BaseViewRestriction.NONE
            ):
                context.update({"is_public": False})
            else:
                is_public = (
                    Page.objects.filter(id=self.parent_page.id).public().exists()
                )
                context.update({"is_public": is_public})

        context.update(
            {
                "model_name": self.model.get_verbose_name(),
                "base_model_name": Page._meta.verbose_name,
                "model_description": self.model.get_page_description(),
                "status_templates": self.get_status_templates(context),
            }
        )

        return context


class CommentsSidePanel(BaseSidePanel):
    class SidePanelToggle(BaseSidePanel.SidePanelToggle):