Browse Source

Use Slack V2 OAuth flow

pull/358/head
Pēteris Caune 5 years ago
parent
commit
56bb49f1f3
No known key found for this signature in database GPG Key ID: E28D7679E9A9EDE2
3 changed files with 8 additions and 3 deletions
  1. +1
    -0
      CHANGELOG.md
  2. +5
    -1
      hc/api/models.py
  3. +2
    -2
      hc/front/views.py

+ 1
- 0
CHANGELOG.md View File

@ -5,6 +5,7 @@ All notable changes to this project will be documented in this file.
### Improvements
- Rate limiting for Telegram notifications (10 notifications per chat per minute)
- Use Slack V2 OAuth flow
### Bug Fixes
- "Get a single check" API call now supports read-only API keys (#346)


+ 5
- 1
hc/api/models.py View File

@ -528,7 +528,11 @@ class Channel(models.Model):
return None
doc = json.loads(self.value)
return doc["team_name"]
if "team_name" in doc:
return doc["team_name"]
if "team" in doc:
return doc["team"]["name"]
@property
def slack_channel(self):


+ 2
- 2
hc/front/views.py View File

@ -1037,7 +1037,7 @@ def add_slack_btn(request, code):
project = _get_project_for_user(request, code)
state = token_urlsafe()
authorize_url = "https://slack.com/oauth/authorize?" + urlencode(
authorize_url = "https://slack.com/oauth/v2/authorize?" + urlencode(
{
"scope": "incoming-webhook",
"client_id": settings.SLACK_CLIENT_ID,
@ -1071,7 +1071,7 @@ def add_slack_complete(request):
return HttpResponseForbidden()
result = requests.post(
"https://slack.com/api/oauth.access",
"https://slack.com/api/oauth.v2.access",
{
"client_id": settings.SLACK_CLIENT_ID,
"client_secret": settings.SLACK_CLIENT_SECRET,


Loading…
Cancel
Save