mirror of
https://github.com/zulip/zulip.git
synced 2025-11-12 01:47:41 +00:00
integrations: Make client_name a kwarg.
All integrations currently use their name as their client name as well. Removed the redundancy of declaring the same name twice, while retaining the support for client names.
This commit is contained in:
@@ -69,8 +69,8 @@ class Integration:
|
|||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
name: str,
|
name: str,
|
||||||
client_name: str,
|
|
||||||
categories: list[str],
|
categories: list[str],
|
||||||
|
client_name: str | None = None,
|
||||||
logo: str | None = None,
|
logo: str | None = None,
|
||||||
secondary_line_text: str | None = None,
|
secondary_line_text: str | None = None,
|
||||||
display_name: str | None = None,
|
display_name: str | None = None,
|
||||||
@@ -80,7 +80,7 @@ class Integration:
|
|||||||
config_options: Sequence[WebhookConfigOption] = [],
|
config_options: Sequence[WebhookConfigOption] = [],
|
||||||
) -> None:
|
) -> None:
|
||||||
self.name = name
|
self.name = name
|
||||||
self.client_name = client_name
|
self.client_name = client_name if client_name is not None else name
|
||||||
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
|
||||||
@@ -210,8 +210,8 @@ class WebhookIntegration(Integration):
|
|||||||
client_name = self.DEFAULT_CLIENT_NAME.format(name=name.title())
|
client_name = self.DEFAULT_CLIENT_NAME.format(name=name.title())
|
||||||
super().__init__(
|
super().__init__(
|
||||||
name,
|
name,
|
||||||
client_name,
|
|
||||||
categories,
|
categories,
|
||||||
|
client_name=client_name,
|
||||||
logo=logo,
|
logo=logo,
|
||||||
secondary_line_text=secondary_line_text,
|
secondary_line_text=secondary_line_text,
|
||||||
display_name=display_name,
|
display_name=display_name,
|
||||||
@@ -311,7 +311,6 @@ class HubotIntegration(Integration):
|
|||||||
self.hubot_docs_url = git_url
|
self.hubot_docs_url = git_url
|
||||||
|
|
||||||
super().__init__(
|
super().__init__(
|
||||||
name,
|
|
||||||
name,
|
name,
|
||||||
categories,
|
categories,
|
||||||
logo=logo,
|
logo=logo,
|
||||||
@@ -331,8 +330,8 @@ class EmbeddedBotIntegration(Integration):
|
|||||||
|
|
||||||
def __init__(self, name: str, *args: Any, **kwargs: Any) -> None:
|
def __init__(self, name: str, *args: Any, **kwargs: Any) -> None:
|
||||||
assert kwargs.get("client_name") is None
|
assert kwargs.get("client_name") is None
|
||||||
client_name = self.DEFAULT_CLIENT_NAME.format(name=name.title())
|
kwargs["client_name"] = self.DEFAULT_CLIENT_NAME.format(name=name.title())
|
||||||
super().__init__(name, client_name, *args, **kwargs)
|
super().__init__(name, *args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
EMBEDDED_BOTS: list[EmbeddedBotIntegration] = [
|
EMBEDDED_BOTS: list[EmbeddedBotIntegration] = [
|
||||||
@@ -506,11 +505,8 @@ WEBHOOK_INTEGRATIONS: list[WebhookIntegration] = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
INTEGRATIONS: dict[str, Integration] = {
|
INTEGRATIONS: dict[str, Integration] = {
|
||||||
"asana": Integration(
|
"asana": Integration("asana", ["project-management"], doc="zerver/integrations/asana.md"),
|
||||||
"asana", "asana", ["project-management"], doc="zerver/integrations/asana.md"
|
|
||||||
),
|
|
||||||
"big-blue-button": Integration(
|
"big-blue-button": Integration(
|
||||||
"big-blue-button",
|
|
||||||
"big-blue-button",
|
"big-blue-button",
|
||||||
["communication"],
|
["communication"],
|
||||||
logo="images/integrations/logos/bigbluebutton.svg",
|
logo="images/integrations/logos/bigbluebutton.svg",
|
||||||
@@ -518,24 +514,20 @@ INTEGRATIONS: dict[str, Integration] = {
|
|||||||
doc="zerver/integrations/big-blue-button.md",
|
doc="zerver/integrations/big-blue-button.md",
|
||||||
),
|
),
|
||||||
"capistrano": Integration(
|
"capistrano": Integration(
|
||||||
"capistrano",
|
|
||||||
"capistrano",
|
"capistrano",
|
||||||
["deployment"],
|
["deployment"],
|
||||||
display_name="Capistrano",
|
display_name="Capistrano",
|
||||||
doc="zerver/integrations/capistrano.md",
|
doc="zerver/integrations/capistrano.md",
|
||||||
),
|
),
|
||||||
"codebase": Integration(
|
"codebase": Integration("codebase", ["version-control"], doc="zerver/integrations/codebase.md"),
|
||||||
"codebase", "codebase", ["version-control"], doc="zerver/integrations/codebase.md"
|
|
||||||
),
|
|
||||||
"discourse": Integration(
|
"discourse": Integration(
|
||||||
"discourse", "discourse", ["communication"], doc="zerver/integrations/discourse.md"
|
"discourse", ["communication"], doc="zerver/integrations/discourse.md"
|
||||||
),
|
),
|
||||||
"email": Integration("email", "email", ["communication"], doc="zerver/integrations/email.md"),
|
"email": Integration("email", ["communication"], doc="zerver/integrations/email.md"),
|
||||||
"errbot": Integration(
|
"errbot": Integration(
|
||||||
"errbot", "errbot", ["meta-integration", "bots"], doc="zerver/integrations/errbot.md"
|
"errbot", ["meta-integration", "bots"], doc="zerver/integrations/errbot.md"
|
||||||
),
|
),
|
||||||
"giphy": Integration(
|
"giphy": Integration(
|
||||||
"giphy",
|
|
||||||
"giphy",
|
"giphy",
|
||||||
display_name="GIPHY",
|
display_name="GIPHY",
|
||||||
categories=["misc"],
|
categories=["misc"],
|
||||||
@@ -543,37 +535,31 @@ INTEGRATIONS: dict[str, Integration] = {
|
|||||||
logo="images/integrations/giphy/GIPHY_big_logo.png",
|
logo="images/integrations/giphy/GIPHY_big_logo.png",
|
||||||
),
|
),
|
||||||
"git": Integration(
|
"git": Integration(
|
||||||
"git", "git", ["version-control"], stream_name="commits", doc="zerver/integrations/git.md"
|
"git", ["version-control"], stream_name="commits", doc="zerver/integrations/git.md"
|
||||||
),
|
),
|
||||||
"github-actions": Integration(
|
"github-actions": Integration(
|
||||||
"github-actions",
|
|
||||||
"github-actions",
|
"github-actions",
|
||||||
["continuous-integration"],
|
["continuous-integration"],
|
||||||
display_name="GitHub Actions",
|
display_name="GitHub Actions",
|
||||||
doc="zerver/integrations/github-actions.md",
|
doc="zerver/integrations/github-actions.md",
|
||||||
),
|
),
|
||||||
"google-calendar": Integration(
|
"google-calendar": Integration(
|
||||||
"google-calendar",
|
|
||||||
"google-calendar",
|
"google-calendar",
|
||||||
["productivity"],
|
["productivity"],
|
||||||
display_name="Google Calendar",
|
display_name="Google Calendar",
|
||||||
doc="zerver/integrations/google-calendar.md",
|
doc="zerver/integrations/google-calendar.md",
|
||||||
),
|
),
|
||||||
"hubot": Integration(
|
"hubot": Integration("hubot", ["meta-integration", "bots"], doc="zerver/integrations/hubot.md"),
|
||||||
"hubot", "hubot", ["meta-integration", "bots"], doc="zerver/integrations/hubot.md"
|
|
||||||
),
|
|
||||||
"irc": Integration(
|
"irc": Integration(
|
||||||
"irc", "irc", ["communication"], display_name="IRC", doc="zerver/integrations/irc.md"
|
"irc", ["communication"], display_name="IRC", doc="zerver/integrations/irc.md"
|
||||||
),
|
),
|
||||||
"jenkins": Integration(
|
"jenkins": Integration(
|
||||||
"jenkins",
|
|
||||||
"jenkins",
|
"jenkins",
|
||||||
["continuous-integration"],
|
["continuous-integration"],
|
||||||
secondary_line_text="(or Hudson)",
|
secondary_line_text="(or Hudson)",
|
||||||
doc="zerver/integrations/jenkins.md",
|
doc="zerver/integrations/jenkins.md",
|
||||||
),
|
),
|
||||||
"jira-plugin": Integration(
|
"jira-plugin": Integration(
|
||||||
"jira-plugin",
|
|
||||||
"jira-plugin",
|
"jira-plugin",
|
||||||
["project-management"],
|
["project-management"],
|
||||||
logo="images/integrations/logos/jira.svg",
|
logo="images/integrations/logos/jira.svg",
|
||||||
@@ -584,7 +570,6 @@ INTEGRATIONS: dict[str, Integration] = {
|
|||||||
legacy=True,
|
legacy=True,
|
||||||
),
|
),
|
||||||
"jitsi": Integration(
|
"jitsi": Integration(
|
||||||
"jitsi",
|
|
||||||
"jitsi",
|
"jitsi",
|
||||||
["communication"],
|
["communication"],
|
||||||
logo="images/integrations/logos/jitsi.svg",
|
logo="images/integrations/logos/jitsi.svg",
|
||||||
@@ -592,51 +577,39 @@ INTEGRATIONS: dict[str, Integration] = {
|
|||||||
doc="zerver/integrations/jitsi.md",
|
doc="zerver/integrations/jitsi.md",
|
||||||
),
|
),
|
||||||
"mastodon": Integration(
|
"mastodon": Integration(
|
||||||
"mastodon",
|
|
||||||
"mastodon",
|
"mastodon",
|
||||||
["communication"],
|
["communication"],
|
||||||
doc="zerver/integrations/mastodon.md",
|
doc="zerver/integrations/mastodon.md",
|
||||||
),
|
),
|
||||||
"matrix": Integration(
|
"matrix": Integration("matrix", ["communication"], doc="zerver/integrations/matrix.md"),
|
||||||
"matrix", "matrix", ["communication"], doc="zerver/integrations/matrix.md"
|
|
||||||
),
|
|
||||||
"mercurial": Integration(
|
"mercurial": Integration(
|
||||||
"mercurial",
|
|
||||||
"mercurial",
|
"mercurial",
|
||||||
["version-control"],
|
["version-control"],
|
||||||
display_name="Mercurial (hg)",
|
display_name="Mercurial (hg)",
|
||||||
doc="zerver/integrations/mercurial.md",
|
doc="zerver/integrations/mercurial.md",
|
||||||
stream_name="commits",
|
stream_name="commits",
|
||||||
),
|
),
|
||||||
"nagios": Integration("nagios", "nagios", ["monitoring"], doc="zerver/integrations/nagios.md"),
|
"nagios": Integration("nagios", ["monitoring"], doc="zerver/integrations/nagios.md"),
|
||||||
"notion": Integration(
|
"notion": Integration("notion", ["productivity"], doc="zerver/integrations/notion.md"),
|
||||||
"notion", "notion", ["productivity"], doc="zerver/integrations/notion.md"
|
|
||||||
),
|
|
||||||
"openshift": Integration(
|
"openshift": Integration(
|
||||||
"openshift",
|
|
||||||
"openshift",
|
"openshift",
|
||||||
["deployment"],
|
["deployment"],
|
||||||
display_name="OpenShift",
|
display_name="OpenShift",
|
||||||
doc="zerver/integrations/openshift.md",
|
doc="zerver/integrations/openshift.md",
|
||||||
stream_name="deployments",
|
stream_name="deployments",
|
||||||
),
|
),
|
||||||
"perforce": Integration(
|
"perforce": Integration("perforce", ["version-control"], doc="zerver/integrations/perforce.md"),
|
||||||
"perforce", "perforce", ["version-control"], doc="zerver/integrations/perforce.md"
|
|
||||||
),
|
|
||||||
"phabricator": Integration(
|
"phabricator": Integration(
|
||||||
"phabricator", "phabricator", ["version-control"], doc="zerver/integrations/phabricator.md"
|
"phabricator", ["version-control"], doc="zerver/integrations/phabricator.md"
|
||||||
),
|
|
||||||
"puppet": Integration("puppet", "puppet", ["deployment"], doc="zerver/integrations/puppet.md"),
|
|
||||||
"redmine": Integration(
|
|
||||||
"redmine", "redmine", ["project-management"], doc="zerver/integrations/redmine.md"
|
|
||||||
),
|
),
|
||||||
|
"puppet": Integration("puppet", ["deployment"], doc="zerver/integrations/puppet.md"),
|
||||||
|
"redmine": Integration("redmine", ["project-management"], doc="zerver/integrations/redmine.md"),
|
||||||
"rss": Integration(
|
"rss": Integration(
|
||||||
"rss", "rss", ["communication"], display_name="RSS", doc="zerver/integrations/rss.md"
|
"rss", ["communication"], display_name="RSS", doc="zerver/integrations/rss.md"
|
||||||
),
|
),
|
||||||
"svn": Integration("svn", "svn", ["version-control"], doc="zerver/integrations/svn.md"),
|
"svn": Integration("svn", ["version-control"], doc="zerver/integrations/svn.md"),
|
||||||
"trac": Integration("trac", "trac", ["project-management"], doc="zerver/integrations/trac.md"),
|
"trac": Integration("trac", ["project-management"], doc="zerver/integrations/trac.md"),
|
||||||
"twitter": Integration(
|
"twitter": Integration(
|
||||||
"twitter",
|
|
||||||
"twitter",
|
"twitter",
|
||||||
["customer-support", "marketing"],
|
["customer-support", "marketing"],
|
||||||
# _ needed to get around adblock plus
|
# _ needed to get around adblock plus
|
||||||
@@ -644,7 +617,6 @@ INTEGRATIONS: dict[str, Integration] = {
|
|||||||
doc="zerver/integrations/twitter.md",
|
doc="zerver/integrations/twitter.md",
|
||||||
),
|
),
|
||||||
"zoom": Integration(
|
"zoom": Integration(
|
||||||
"zoom",
|
|
||||||
"zoom",
|
"zoom",
|
||||||
["communication"],
|
["communication"],
|
||||||
logo="images/integrations/logos/zoom.svg",
|
logo="images/integrations/logos/zoom.svg",
|
||||||
|
|||||||
Reference in New Issue
Block a user