mirror of
https://github.com/zulip/zulip.git
synced 2025-11-20 14:38:46 +00:00
integrations: Migrate channel name from Integration to ScreenshotConfig.
Migrate `stream_name` in Integration class to `channel` in `WebhookScreenshotConfig` and `FixturelessScreenshotConfig` dataclasses. `stream_name` is being used only when generating screenshots, and hence belongs better in the screenshot config objects. In the next commit, the ScreenshotConfig will be added as an Integration property.
This commit is contained in:
@@ -108,7 +108,6 @@ class Integration:
|
||||
secondary_line_text: str | None = None,
|
||||
display_name: str | None = None,
|
||||
doc: str | None = None,
|
||||
stream_name: str | None = None,
|
||||
legacy: bool = False,
|
||||
config_options: Sequence[WebhookConfigOption] = [],
|
||||
url_options: Sequence[WebhookUrlOption] = [],
|
||||
@@ -148,10 +147,6 @@ class Integration:
|
||||
doc = self.DEFAULT_DOC_PATH.format(name=self.name)
|
||||
self.doc = doc
|
||||
|
||||
if stream_name is None:
|
||||
stream_name = self.name
|
||||
self.stream_name = stream_name
|
||||
|
||||
def is_enabled(self) -> bool:
|
||||
return True
|
||||
|
||||
@@ -236,7 +231,6 @@ class PythonAPIIntegration(Integration):
|
||||
display_name: str | None = None,
|
||||
directory_name: str | None = None,
|
||||
doc: str | None = None,
|
||||
stream_name: str | None = None,
|
||||
legacy: bool = False,
|
||||
) -> None:
|
||||
if directory_name is None:
|
||||
@@ -256,7 +250,6 @@ class PythonAPIIntegration(Integration):
|
||||
secondary_line_text=secondary_line_text,
|
||||
display_name=display_name,
|
||||
doc=doc,
|
||||
stream_name=stream_name,
|
||||
legacy=legacy,
|
||||
)
|
||||
|
||||
@@ -278,7 +271,6 @@ class WebhookIntegration(Integration):
|
||||
url: str | None = None,
|
||||
display_name: str | None = None,
|
||||
doc: str | None = None,
|
||||
stream_name: str | None = None,
|
||||
legacy: bool = False,
|
||||
config_options: Sequence[WebhookConfigOption] = [],
|
||||
url_options: Sequence[WebhookUrlOption] = [],
|
||||
@@ -293,7 +285,6 @@ class WebhookIntegration(Integration):
|
||||
logo=logo,
|
||||
secondary_line_text=secondary_line_text,
|
||||
display_name=display_name,
|
||||
stream_name=stream_name,
|
||||
legacy=legacy,
|
||||
config_options=config_options,
|
||||
url_options=url_options,
|
||||
@@ -343,6 +334,7 @@ class WebhookScreenshotConfig:
|
||||
image_name: str = "001.png"
|
||||
image_dir: str | None = None
|
||||
bot_name: str | None = None
|
||||
channel: str | None = None
|
||||
payload_as_query_param: bool = False
|
||||
payload_param_name: str = "payload"
|
||||
extra_params: dict[str, str] = field(default_factory=dict)
|
||||
@@ -448,7 +440,7 @@ WEBHOOK_INTEGRATIONS: list[WebhookIntegration] = [
|
||||
display_name="AzureDevOps",
|
||||
url_options=[WebhookUrlOption.build_preset_config(PresetUrlOption.BRANCHES)],
|
||||
),
|
||||
WebhookIntegration("beanstalk", ["version-control"], stream_name="commits"),
|
||||
WebhookIntegration("beanstalk", ["version-control"]),
|
||||
WebhookIntegration("basecamp", ["project-management"]),
|
||||
WebhookIntegration("beeminder", ["misc"], display_name="Beeminder"),
|
||||
WebhookIntegration(
|
||||
@@ -456,7 +448,6 @@ WEBHOOK_INTEGRATIONS: list[WebhookIntegration] = [
|
||||
["version-control"],
|
||||
logo="images/integrations/logos/bitbucket.svg",
|
||||
display_name="Bitbucket Server",
|
||||
stream_name="bitbucket",
|
||||
url_options=[WebhookUrlOption.build_preset_config(PresetUrlOption.BRANCHES)],
|
||||
),
|
||||
WebhookIntegration(
|
||||
@@ -464,7 +455,6 @@ WEBHOOK_INTEGRATIONS: list[WebhookIntegration] = [
|
||||
["version-control"],
|
||||
logo="images/integrations/logos/bitbucket.svg",
|
||||
display_name="Bitbucket",
|
||||
stream_name="bitbucket",
|
||||
url_options=[WebhookUrlOption.build_preset_config(PresetUrlOption.BRANCHES)],
|
||||
),
|
||||
WebhookIntegration(
|
||||
@@ -472,7 +462,6 @@ WEBHOOK_INTEGRATIONS: list[WebhookIntegration] = [
|
||||
["version-control"],
|
||||
display_name="Bitbucket",
|
||||
secondary_line_text="(Enterprise)",
|
||||
stream_name="commits",
|
||||
legacy=True,
|
||||
),
|
||||
WebhookIntegration("buildbot", ["continuous-integration"]),
|
||||
@@ -493,7 +482,6 @@ WEBHOOK_INTEGRATIONS: list[WebhookIntegration] = [
|
||||
WebhookIntegration(
|
||||
"gitea",
|
||||
["version-control"],
|
||||
stream_name="commits",
|
||||
url_options=[WebhookUrlOption.build_preset_config(PresetUrlOption.BRANCHES)],
|
||||
),
|
||||
WebhookIntegration(
|
||||
@@ -512,7 +500,6 @@ WEBHOOK_INTEGRATIONS: list[WebhookIntegration] = [
|
||||
logo="images/integrations/logos/github.svg",
|
||||
dir_name="github",
|
||||
doc="github/githubsponsors.md",
|
||||
stream_name="github",
|
||||
),
|
||||
WebhookIntegration(
|
||||
"gitlab",
|
||||
@@ -524,7 +511,6 @@ WEBHOOK_INTEGRATIONS: list[WebhookIntegration] = [
|
||||
WebhookIntegration(
|
||||
"gogs",
|
||||
["version-control"],
|
||||
stream_name="commits",
|
||||
url_options=[WebhookUrlOption.build_preset_config(PresetUrlOption.BRANCHES)],
|
||||
),
|
||||
WebhookIntegration("gosquared", ["marketing"], display_name="GoSquared"),
|
||||
@@ -618,10 +604,7 @@ INTEGRATIONS: dict[str, Integration] = {
|
||||
"errbot": Integration("errbot", ["meta-integration", "bots"]),
|
||||
"giphy": Integration("giphy", ["misc"], display_name="GIPHY"),
|
||||
"github-actions": Integration(
|
||||
"github-actions",
|
||||
["continuous-integration"],
|
||||
display_name="GitHub Actions",
|
||||
stream_name="github-actions updates",
|
||||
"github-actions", ["continuous-integration"], display_name="GitHub Actions"
|
||||
),
|
||||
"hubot": Integration("hubot", ["meta-integration", "bots"]),
|
||||
"jenkins": Integration("jenkins", ["continuous-integration"]),
|
||||
@@ -636,7 +619,7 @@ INTEGRATIONS: dict[str, Integration] = {
|
||||
|
||||
PYTHON_API_INTEGRATIONS: list[PythonAPIIntegration] = [
|
||||
PythonAPIIntegration("codebase", ["version-control"]),
|
||||
PythonAPIIntegration("git", ["version-control"], stream_name="commits"),
|
||||
PythonAPIIntegration("git", ["version-control"]),
|
||||
PythonAPIIntegration(
|
||||
"google-calendar", ["productivity"], display_name="Google Calendar", directory_name="google"
|
||||
),
|
||||
@@ -650,21 +633,14 @@ PYTHON_API_INTEGRATIONS: list[PythonAPIIntegration] = [
|
||||
secondary_line_text="(locally installed)",
|
||||
display_name="Jira",
|
||||
directory_name="jira",
|
||||
stream_name="jira",
|
||||
legacy=True,
|
||||
),
|
||||
PythonAPIIntegration("matrix", ["communication"], directory_name="bridge_with_matrix"),
|
||||
PythonAPIIntegration(
|
||||
"mercurial",
|
||||
["version-control"],
|
||||
display_name="Mercurial (hg)",
|
||||
stream_name="commits",
|
||||
directory_name="hg",
|
||||
"mercurial", ["version-control"], display_name="Mercurial (hg)", directory_name="hg"
|
||||
),
|
||||
PythonAPIIntegration("nagios", ["monitoring"]),
|
||||
PythonAPIIntegration(
|
||||
"openshift", ["deployment"], display_name="OpenShift", stream_name="deployments"
|
||||
),
|
||||
PythonAPIIntegration("openshift", ["deployment"], display_name="OpenShift"),
|
||||
PythonAPIIntegration("perforce", ["version-control"]),
|
||||
PythonAPIIntegration("rss", ["communication"], display_name="RSS"),
|
||||
PythonAPIIntegration("svn", ["version-control"], display_name="Subversion"),
|
||||
@@ -768,18 +744,26 @@ WEBHOOK_SCREENSHOT_CONFIG: dict[str, list[WebhookScreenshotConfig]] = {
|
||||
"basecamp": [WebhookScreenshotConfig("doc_active.json")],
|
||||
"beanstalk": [
|
||||
WebhookScreenshotConfig(
|
||||
"git_multiple.json", use_basic_auth=True, payload_as_query_param=True
|
||||
"git_multiple.json", channel="commits", use_basic_auth=True, payload_as_query_param=True
|
||||
)
|
||||
],
|
||||
# 'beeminder': [WebhookScreenshotConfig('derail_worried.json')],
|
||||
"bitbucket": [
|
||||
WebhookScreenshotConfig(
|
||||
"push.json", "002.png", use_basic_auth=True, payload_as_query_param=True
|
||||
"push.json",
|
||||
"002.png",
|
||||
channel="commits",
|
||||
use_basic_auth=True,
|
||||
payload_as_query_param=True,
|
||||
)
|
||||
],
|
||||
"bitbucket2": [
|
||||
WebhookScreenshotConfig(
|
||||
"issue_created.json", "003.png", "bitbucket", bot_name="Bitbucket Bot"
|
||||
"issue_created.json",
|
||||
"003.png",
|
||||
"bitbucket",
|
||||
bot_name="Bitbucket Bot",
|
||||
channel="bitbucket",
|
||||
)
|
||||
],
|
||||
"bitbucket3": [
|
||||
@@ -788,6 +772,7 @@ WEBHOOK_SCREENSHOT_CONFIG: dict[str, list[WebhookScreenshotConfig]] = {
|
||||
"004.png",
|
||||
"bitbucket",
|
||||
bot_name="Bitbucket Server Bot",
|
||||
channel="bitbucket",
|
||||
)
|
||||
],
|
||||
"buildbot": [WebhookScreenshotConfig("started.json")],
|
||||
@@ -809,12 +794,12 @@ WEBHOOK_SCREENSHOT_CONFIG: dict[str, list[WebhookScreenshotConfig]] = {
|
||||
"freshping": [WebhookScreenshotConfig("freshping_check_unreachable.json")],
|
||||
"freshstatus": [WebhookScreenshotConfig("freshstatus_incident_open.json")],
|
||||
"front": [WebhookScreenshotConfig("inbound_message.json")],
|
||||
"gitea": [WebhookScreenshotConfig("pull_request__merged.json")],
|
||||
"gitea": [WebhookScreenshotConfig("pull_request__merged.json", channel="commits")],
|
||||
"github": [WebhookScreenshotConfig("push__1_commit.json")],
|
||||
"githubsponsors": [WebhookScreenshotConfig("created.json")],
|
||||
"githubsponsors": [WebhookScreenshotConfig("created.json", channel="github")],
|
||||
"gitlab": [WebhookScreenshotConfig("push_hook__push_local_branch_without_commits.json")],
|
||||
"gocd": [WebhookScreenshotConfig("pipeline_with_mixed_job_result.json")],
|
||||
"gogs": [WebhookScreenshotConfig("pull_request__opened.json")],
|
||||
"gogs": [WebhookScreenshotConfig("pull_request__opened.json", channel="commits")],
|
||||
"gosquared": [WebhookScreenshotConfig("traffic_spike.json")],
|
||||
"grafana": [WebhookScreenshotConfig("alert_values_v11.json")],
|
||||
"greenhouse": [WebhookScreenshotConfig("candidate_stage_change.json")],
|
||||
@@ -908,9 +893,13 @@ for integration, screenshots_contents in FIXTURELESS_SCREENSHOT_CONTENT.items():
|
||||
]
|
||||
|
||||
FIXTURELESS_SCREENSHOT_CONFIG_OPTIONAL_FIELDS = {
|
||||
"mercurial": {"image_dir": "hg"},
|
||||
"jenkins": {"image_name": "004.png"},
|
||||
"git": {"channel": "commits"},
|
||||
"github-actions": {"channel": "github-actions updates"},
|
||||
"google-calendar": {"image_name": "003.png", "image_dir": "google/calendar"},
|
||||
"jenkins": {"image_name": "004.png"},
|
||||
"jira-plugin": {"channel": "jira"},
|
||||
"mercurial": {"image_dir": "hg", "channel": "commits"},
|
||||
"openshift": {"channel": "deployments"},
|
||||
}
|
||||
|
||||
for integration, fields in FIXTURELESS_SCREENSHOT_CONFIG_OPTIONAL_FIELDS.items():
|
||||
|
||||
Reference in New Issue
Block a user