templates: Make zulip_default_context available in API endpoints.

This is mostly useful for advertising support_email, but some other
fields may by helpful over time.
This commit is contained in:
Tim Abbott 2018-06-01 11:31:16 -07:00
parent 95f1f1d363
commit c37fe998d2
2 changed files with 4 additions and 0 deletions

View File

@ -15,6 +15,7 @@ import zerver.lib.bugdown.fenced_code
import zerver.lib.bugdown.api_arguments_table_generator import zerver.lib.bugdown.api_arguments_table_generator
import zerver.lib.bugdown.api_code_examples import zerver.lib.bugdown.api_code_examples
import zerver.lib.bugdown.help_settings_links import zerver.lib.bugdown.help_settings_links
from zerver.context_processors import zulip_default_context
from zerver.lib.cache import ignore_unhashable_lru_cache from zerver.lib.cache import ignore_unhashable_lru_cache
register = Library() register = Library()

View File

@ -16,8 +16,11 @@ from zerver.lib.request import has_request_variables, REQ
from zerver.lib.subdomains import get_subdomain from zerver.lib.subdomains import get_subdomain
from zerver.models import Realm from zerver.models import Realm
from zerver.templatetags.app_filters import render_markdown_path from zerver.templatetags.app_filters import render_markdown_path
from zerver.context_processors import zulip_default_context
def add_api_uri_context(context: Dict[str, Any], request: HttpRequest) -> None: def add_api_uri_context(context: Dict[str, Any], request: HttpRequest) -> None:
context.update(zulip_default_context(request))
subdomain = get_subdomain(request) subdomain = get_subdomain(request)
if (subdomain != Realm.SUBDOMAIN_FOR_ROOT_DOMAIN if (subdomain != Realm.SUBDOMAIN_FOR_ROOT_DOMAIN
or not settings.ROOT_DOMAIN_LANDING_PAGE): or not settings.ROOT_DOMAIN_LANDING_PAGE):