mirror of https://github.com/zulip/zulip.git
api_url_context: Replace `uri` with `url`.
In #23380 we want to change all occurrences of `uri` with `url`. This commit changes the occurrences in a context key `api_uri_context` and a function name `add_api_uri_context`.
This commit is contained in:
parent
98c9a0366a
commit
0a1ccb3d89
|
@ -20,7 +20,7 @@
|
|||
{% elif page_is_help_center %}
|
||||
{{ render_markdown_path(sidebar_index) }}
|
||||
{% else %}
|
||||
{{ render_markdown_path(sidebar_index, context=api_uri_context) }}
|
||||
{{ render_markdown_path(sidebar_index, context=api_url_context) }}
|
||||
{% endif %}
|
||||
|
||||
{% if not page_is_policy_center %}
|
||||
|
@ -38,9 +38,9 @@
|
|||
{% if page_is_policy_center %}
|
||||
{{ render_markdown_path(article) }}
|
||||
{% elif page_is_help_center %}
|
||||
{{ render_markdown_path(article, context=api_uri_context, help_center=True) }}
|
||||
{{ render_markdown_path(article, context=api_url_context, help_center=True) }}
|
||||
{% else %}
|
||||
{{ render_markdown_path(article, context=api_uri_context) }}
|
||||
{{ render_markdown_path(article, context=api_url_context) }}
|
||||
{% endif %}
|
||||
|
||||
<div class="documentation-footer">
|
||||
|
|
|
@ -15,7 +15,7 @@ from zerver.lib.integrations import CATEGORIES, INTEGRATIONS, META_CATEGORY
|
|||
from zerver.lib.test_classes import ZulipTestCase
|
||||
from zerver.lib.test_helpers import HostRequestMock
|
||||
from zerver.models import Realm, get_realm
|
||||
from zerver.views.documentation import add_api_uri_context
|
||||
from zerver.views.documentation import add_api_url_context
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from django.test.client import _MonkeyPatchedWSGIResponse as TestHttpResponse
|
||||
|
@ -356,7 +356,7 @@ class IntegrationTest(ZulipTestCase):
|
|||
|
||||
def test_api_url_view_subdomains_base(self) -> None:
|
||||
context: Dict[str, Any] = {}
|
||||
add_api_uri_context(context, HostRequestMock())
|
||||
add_api_url_context(context, HostRequestMock())
|
||||
self.assertEqual(context["api_url_scheme_relative"], "testserver/api")
|
||||
self.assertEqual(context["api_url"], "http://testserver/api")
|
||||
self.assertTrue(context["html_settings_links"])
|
||||
|
@ -364,7 +364,7 @@ class IntegrationTest(ZulipTestCase):
|
|||
@override_settings(ROOT_DOMAIN_LANDING_PAGE=True)
|
||||
def test_api_url_view_subdomains_homepage_base(self) -> None:
|
||||
context: Dict[str, Any] = {}
|
||||
add_api_uri_context(context, HostRequestMock())
|
||||
add_api_url_context(context, HostRequestMock())
|
||||
self.assertEqual(context["api_url_scheme_relative"], "yourZulipDomain.testserver/api")
|
||||
self.assertEqual(context["api_url"], "http://yourZulipDomain.testserver/api")
|
||||
self.assertFalse(context["html_settings_links"])
|
||||
|
@ -372,7 +372,7 @@ class IntegrationTest(ZulipTestCase):
|
|||
def test_api_url_view_subdomains_full(self) -> None:
|
||||
context: Dict[str, Any] = {}
|
||||
request = HostRequestMock(host="mysubdomain.testserver")
|
||||
add_api_uri_context(context, request)
|
||||
add_api_url_context(context, request)
|
||||
self.assertEqual(context["api_url_scheme_relative"], "mysubdomain.testserver/api")
|
||||
self.assertEqual(context["api_url"], "http://mysubdomain.testserver/api")
|
||||
self.assertTrue(context["html_settings_links"])
|
||||
|
|
|
@ -34,7 +34,7 @@ class DocumentationArticle:
|
|||
endpoint_method: Optional[str]
|
||||
|
||||
|
||||
def add_api_uri_context(context: Dict[str, Any], request: HttpRequest) -> None:
|
||||
def add_api_url_context(context: Dict[str, Any], request: HttpRequest) -> None:
|
||||
context.update(zulip_default_context(request))
|
||||
|
||||
subdomain = get_subdomain(request)
|
||||
|
@ -61,7 +61,7 @@ def add_api_uri_context(context: Dict[str, Any], request: HttpRequest) -> None:
|
|||
class ApiURLView(TemplateView):
|
||||
def get_context_data(self, **kwargs: Any) -> Dict[str, str]:
|
||||
context = super().get_context_data(**kwargs)
|
||||
add_api_uri_context(context, self.request)
|
||||
add_api_url_context(context, self.request)
|
||||
return context
|
||||
|
||||
|
||||
|
@ -216,13 +216,13 @@ class MarkdownDirectoryView(ApiURLView):
|
|||
context["PAGE_DESCRIPTION"] = request_notes.placeholder_open_graph_description
|
||||
|
||||
context["sidebar_index"] = sidebar_index
|
||||
# An "article" might require the api_uri_context to be rendered
|
||||
api_uri_context: Dict[str, Any] = {}
|
||||
add_api_uri_context(api_uri_context, self.request)
|
||||
api_uri_context["run_content_validators"] = True
|
||||
context["api_uri_context"] = api_uri_context
|
||||
# An "article" might require the api_url_context to be rendered
|
||||
api_url_context: Dict[str, Any] = {}
|
||||
add_api_url_context(api_url_context, self.request)
|
||||
api_url_context["run_content_validators"] = True
|
||||
context["api_url_context"] = api_url_context
|
||||
if endpoint_name and endpoint_method:
|
||||
context["api_uri_context"]["API_ENDPOINT_NAME"] = endpoint_name + ":" + endpoint_method
|
||||
context["api_url_context"]["API_ENDPOINT_NAME"] = endpoint_name + ":" + endpoint_method
|
||||
add_google_analytics_context(context)
|
||||
return context
|
||||
|
||||
|
@ -304,7 +304,7 @@ def integration_doc(request: HttpRequest, integration_name: str = REQ()) -> Http
|
|||
return HttpResponseNotFound()
|
||||
|
||||
context: Dict[str, Any] = {}
|
||||
add_api_uri_context(context, request)
|
||||
add_api_url_context(context, request)
|
||||
|
||||
context["integration_name"] = integration.name
|
||||
context["integration_display_name"] = integration.display_name
|
||||
|
|
Loading…
Reference in New Issue