This fixes 2 (what I believe to be) bugs in the current code:
app/models/slack_account.rb was attempting to use
auth_hash[:info][:team_domain] to set the team domain (actually the
subdomain prepended to slack.com to form the URL to a workspace. That
key does not exist in the OAuth data; I suspect it used to and that we
haven't updated the code since Slack made API changes.
Unfortunately, per
https://api.slack.com/authentication/oauth-v2#waiting, Slack no longer
returns the team domain. They do however return the URL to the
workspace. I updated the code to extract the subdomain from the
workspace URL and use that as the domain.
app/models/slack_bot.rb was attempting to use
bot_info[:bot_user_id] to get the bot user id, which also does not
exist as far as I can tell. I updated it to use
bot_info[:bot_access_token], which is what the code uses immediately
below; I think this was an actual bug where the two should be
referencing the same keys.
It also tidies up code in a few places to improve readability.
This fixes 2 (what I believe to be) bugs in the current code:
app/models/slack_account.rb
was attempting to useauth_hash[:info][:team_domain]
to set the team domain (actually the subdomain prepended toslack.com
to form the URL to a workspace. That key does not exist in the OAuth data; I suspect it used to and that we haven't updated the code since Slack made API changes. Unfortunately, per https://api.slack.com/authentication/oauth-v2#waiting, Slack no longer returns the team domain. They do however return the URL to the workspace. I updated the code to extract the subdomain from the workspace URL and use that as the domain.app/models/slack_bot.rb
was attempting to usebot_info[:bot_user_id]
to get the bot user id, which also does not exist as far as I can tell. I updated it to usebot_info[:bot_access_token]
, which is what the code uses immediately below; I think this was an actual bug where the two should be referencing the same keys.It also tidies up code in a few places to improve readability.