mirror of https://github.com/zulip/zulip.git
integrations: Extract integration event types returning function.
This commit is contained in:
parent
38ba97c1ac
commit
2370372705
|
@ -830,3 +830,12 @@ DOC_SCREENSHOT_CONFIG: Dict[str, List[BaseScreenshotConfig]] = {
|
|||
)
|
||||
],
|
||||
}
|
||||
|
||||
|
||||
def get_all_event_types_for_integration(integration: Integration) -> Optional[List[str]]:
|
||||
integration = INTEGRATIONS[integration.name]
|
||||
if isinstance(integration, WebhookIntegration) and hasattr(
|
||||
integration.function, "_all_event_types"
|
||||
):
|
||||
return integration.function._all_event_types
|
||||
return None
|
||||
|
|
|
@ -21,6 +21,7 @@ from zerver.lib.integrations import (
|
|||
META_CATEGORY,
|
||||
HubotIntegration,
|
||||
WebhookIntegration,
|
||||
get_all_event_types_for_integration,
|
||||
)
|
||||
from zerver.lib.request import REQ, RequestNotes, has_request_variables
|
||||
from zerver.lib.subdomains import get_subdomain
|
||||
|
@ -345,11 +346,9 @@ def integration_doc(request: HttpRequest, integration_name: str = REQ()) -> Http
|
|||
context["recommended_stream_name"] = integration.stream_name
|
||||
if isinstance(integration, WebhookIntegration):
|
||||
context["integration_url"] = integration.url[3:]
|
||||
if (
|
||||
hasattr(integration.function, "_all_event_types")
|
||||
and integration.function._all_event_types is not None
|
||||
):
|
||||
context["all_event_types"] = integration.function._all_event_types
|
||||
all_event_types = get_all_event_types_for_integration(integration)
|
||||
if all_event_types is not None:
|
||||
context["all_event_types"] = all_event_types
|
||||
if isinstance(integration, HubotIntegration):
|
||||
context["hubot_docs_url"] = integration.hubot_docs_url
|
||||
|
||||
|
|
Loading…
Reference in New Issue