FIX: Allow slash commands to set rules in private groups

The Slack 'slash commands' API does not provide the user-friendly group name, so we must use the group ID. We could use the API to obtain the group name, but it would require adding additional scopes to the app.
This commit is contained in:
David Taylor 2019-09-30 13:27:35 +01:00
parent 154361e22c
commit 7e5dc5acc1
2 changed files with 3 additions and 1 deletions

View File

@ -28,6 +28,8 @@ module DiscourseChat::Provider::SlackProvider
case params[:channel_name]
when 'directmessage'
"@#{params[:user_name]}"
when 'privategroup'
params[:channel_id]
else
"##{params[:channel_name]}"
end

View File

@ -6,7 +6,7 @@ module DiscourseChat::Provider::SlackProvider
PROVIDER_ENABLED_SETTING = :chat_integration_slack_enabled
CHANNEL_PARAMETERS = [
{ key: "identifier", regex: '^[@#]\S*$', unique: true }
{ key: "identifier", regex: '^[@#]?\S*$', unique: true }
]
def self.excerpt(post, max_length = SiteSetting.chat_integration_slack_excerpt_length)