mirror of
https://github.com/zulip/zulip.git
synced 2025-11-01 20:44:04 +00:00
request: Move miscellaneous attributes to ZulipRequestNotes.
This includes the migration of fields that require trivial changes to be migrated to be stored with ZulipRequestNotes. Specifically _requestor_for_logs, _set_language, _query, error_format, placeholder_open_graph_description, saveed_response, which were all previously set on the HttpRequest object at some point. This migration allows them to be typed.
This commit is contained in:
@@ -13,7 +13,7 @@ from django.views.generic import TemplateView
|
||||
from zerver.context_processors import zulip_default_context
|
||||
from zerver.decorator import add_google_analytics_context
|
||||
from zerver.lib.integrations import CATEGORIES, INTEGRATIONS, HubotIntegration, WebhookIntegration
|
||||
from zerver.lib.request import REQ, has_request_variables
|
||||
from zerver.lib.request import REQ, get_request_notes, has_request_variables
|
||||
from zerver.lib.subdomains import get_subdomain
|
||||
from zerver.lib.templates import render_markdown_path
|
||||
from zerver.models import Realm
|
||||
@@ -168,10 +168,11 @@ class MarkdownDirectoryView(ApiURLView):
|
||||
context["OPEN_GRAPH_TITLE"] = f"{article_title} ({title_base})"
|
||||
else:
|
||||
context["OPEN_GRAPH_TITLE"] = title_base
|
||||
self.request.placeholder_open_graph_description = (
|
||||
request_notes = get_request_notes(self.request)
|
||||
request_notes.placeholder_open_graph_description = (
|
||||
f"REPLACMENT_OPEN_GRAPH_DESCRIPTION_{int(2**24 * random.random())}"
|
||||
)
|
||||
context["OPEN_GRAPH_DESCRIPTION"] = self.request.placeholder_open_graph_description
|
||||
context["OPEN_GRAPH_DESCRIPTION"] = request_notes.placeholder_open_graph_description
|
||||
|
||||
context["sidebar_index"] = sidebar_index
|
||||
# An "article" might require the api_uri_context to be rendered
|
||||
|
||||
Reference in New Issue
Block a user