Skip to content

Commit

Permalink
remove redundant fields from slack alert destination (#5514)
Browse files Browse the repository at this point in the history
  • Loading branch information
rauchy authored Jun 15, 2021
1 parent 041b184 commit ff7c5e8
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions redash/destinations/slack.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,8 @@ def configuration_schema(cls):
"type": "object",
"properties": {
"url": {"type": "string", "title": "Slack Webhook URL"},
"username": {"type": "string", "title": "Username"},
"icon_emoji": {"type": "string", "title": "Icon (Emoji)"},
"icon_url": {"type": "string", "title": "Icon (URL)"},
"channel": {"type": "string", "title": "Channel"},
},
"secret": ["url"]
"secret": ["url"],
}

@classmethod
Expand Down Expand Up @@ -56,15 +52,6 @@ def notify(self, alert, query, user, new_state, app, host, options):

payload = {"attachments": [{"text": text, "color": color, "fields": fields}]}

if options.get("username"):
payload["username"] = options.get("username")
if options.get("icon_emoji"):
payload["icon_emoji"] = options.get("icon_emoji")
if options.get("icon_url"):
payload["icon_url"] = options.get("icon_url")
if options.get("channel"):
payload["channel"] = options.get("channel")

try:
resp = requests.post(
options.get("url"), data=json_dumps(payload), timeout=5.0
Expand Down

0 comments on commit ff7c5e8

Please sign in to comment.