mirror of
https://github.com/zulip/zulip.git
synced 2025-11-16 11:52:01 +00:00
lib/integrations: Remove Integration.doc_context.
An Integration object doesn't need access to the context dict used to render its doc.md, since the context dict is just passed directly to render_markdown_path.
This commit is contained in:
@@ -61,7 +61,6 @@ class Integration:
|
|||||||
self.secondary_line_text = secondary_line_text
|
self.secondary_line_text = secondary_line_text
|
||||||
self.legacy = legacy
|
self.legacy = legacy
|
||||||
self.doc = doc
|
self.doc = doc
|
||||||
self.doc_context = None # type: Optional[Dict[Any, Any]]
|
|
||||||
|
|
||||||
for category in categories:
|
for category in categories:
|
||||||
if category not in CATEGORIES:
|
if category not in CATEGORIES:
|
||||||
@@ -87,10 +86,6 @@ class Integration:
|
|||||||
# type: () -> bool
|
# type: () -> bool
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def add_doc_context(self, context):
|
|
||||||
# type: (Dict[Any, Any]) -> None
|
|
||||||
self.doc_context = context
|
|
||||||
|
|
||||||
def get_logo_url(self):
|
def get_logo_url(self):
|
||||||
# type: () -> Optional[str]
|
# type: () -> Optional[str]
|
||||||
logo_file_path_svg = str(pathlib.PurePath(
|
logo_file_path_svg = str(pathlib.PurePath(
|
||||||
|
|||||||
@@ -127,8 +127,6 @@ def add_context_for_single_integration(context, name, request):
|
|||||||
context['settings_html'] = settings_html
|
context['settings_html'] = settings_html
|
||||||
context['subscriptions_html'] = subscriptions_html
|
context['subscriptions_html'] = subscriptions_html
|
||||||
|
|
||||||
INTEGRATIONS[name].add_doc_context(context)
|
|
||||||
|
|
||||||
|
|
||||||
class IntegrationView(ApiURLView):
|
class IntegrationView(ApiURLView):
|
||||||
template_name = 'zerver/integrations/index.html'
|
template_name = 'zerver/integrations/index.html'
|
||||||
@@ -148,7 +146,7 @@ def integration_doc(request, integration_name=REQ(default=None)):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return HttpResponseNotFound()
|
return HttpResponseNotFound()
|
||||||
|
|
||||||
context = integration.doc_context or {}
|
context = {} # type: Dict[str, Any]
|
||||||
add_context_for_single_integration(context, integration_name, request)
|
add_context_for_single_integration(context, integration_name, request)
|
||||||
|
|
||||||
context['integration_name'] = integration.name
|
context['integration_name'] = integration.name
|
||||||
|
|||||||
Reference in New Issue
Block a user