forked from GithubBackups/healthchecks
Use Slack V2 OAuth flow
This commit is contained in:
parent
9d2cf4f008
commit
56bb49f1f3
@ -5,6 +5,7 @@ All notable changes to this project will be documented in this file.
|
|||||||
|
|
||||||
### Improvements
|
### Improvements
|
||||||
- Rate limiting for Telegram notifications (10 notifications per chat per minute)
|
- Rate limiting for Telegram notifications (10 notifications per chat per minute)
|
||||||
|
- Use Slack V2 OAuth flow
|
||||||
|
|
||||||
### Bug Fixes
|
### Bug Fixes
|
||||||
- "Get a single check" API call now supports read-only API keys (#346)
|
- "Get a single check" API call now supports read-only API keys (#346)
|
||||||
|
@ -528,8 +528,12 @@ class Channel(models.Model):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
doc = json.loads(self.value)
|
doc = json.loads(self.value)
|
||||||
|
if "team_name" in doc:
|
||||||
return doc["team_name"]
|
return doc["team_name"]
|
||||||
|
|
||||||
|
if "team" in doc:
|
||||||
|
return doc["team"]["name"]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def slack_channel(self):
|
def slack_channel(self):
|
||||||
assert self.kind == "slack"
|
assert self.kind == "slack"
|
||||||
|
@ -1037,7 +1037,7 @@ def add_slack_btn(request, code):
|
|||||||
project = _get_project_for_user(request, code)
|
project = _get_project_for_user(request, code)
|
||||||
|
|
||||||
state = token_urlsafe()
|
state = token_urlsafe()
|
||||||
authorize_url = "https://slack.com/oauth/authorize?" + urlencode(
|
authorize_url = "https://slack.com/oauth/v2/authorize?" + urlencode(
|
||||||
{
|
{
|
||||||
"scope": "incoming-webhook",
|
"scope": "incoming-webhook",
|
||||||
"client_id": settings.SLACK_CLIENT_ID,
|
"client_id": settings.SLACK_CLIENT_ID,
|
||||||
@ -1071,7 +1071,7 @@ def add_slack_complete(request):
|
|||||||
return HttpResponseForbidden()
|
return HttpResponseForbidden()
|
||||||
|
|
||||||
result = requests.post(
|
result = requests.post(
|
||||||
"https://slack.com/api/oauth.access",
|
"https://slack.com/api/oauth.v2.access",
|
||||||
{
|
{
|
||||||
"client_id": settings.SLACK_CLIENT_ID,
|
"client_id": settings.SLACK_CLIENT_ID,
|
||||||
"client_secret": settings.SLACK_CLIENT_SECRET,
|
"client_secret": settings.SLACK_CLIENT_SECRET,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user