mirror of
https://github.com/discourse/discourse-chat-integration.git
synced 2025-07-10 07:23:26 +00:00
FEATURE: support for slack custom username (#22)
* FEATURE: support for slack custom username * make slack username setting backwards compatible * fix slack username behavior when empty string
This commit is contained in:
parent
df44beb9a3
commit
695d56a3dd
@ -7,6 +7,7 @@ en:
|
|||||||
#######################################
|
#######################################
|
||||||
########## SLACK SETTINGS #############
|
########## SLACK SETTINGS #############
|
||||||
#######################################
|
#######################################
|
||||||
|
chat_integration_slack_username: "Bot's username to post to slack with"
|
||||||
chat_integration_slack_enabled: 'Enable the slack chat-integration provider'
|
chat_integration_slack_enabled: 'Enable the slack chat-integration provider'
|
||||||
chat_integration_slack_access_token: 'OAuth Access Token for authenticating with Slack'
|
chat_integration_slack_access_token: 'OAuth Access Token for authenticating with Slack'
|
||||||
chat_integration_slack_incoming_webhook_token: 'The verification token used to authenticate incoming requests'
|
chat_integration_slack_incoming_webhook_token: 'The verification token used to authenticate incoming requests'
|
||||||
|
@ -10,6 +10,8 @@ chat_integration:
|
|||||||
#######################################
|
#######################################
|
||||||
########## SLACK SETTINGS #############
|
########## SLACK SETTINGS #############
|
||||||
#######################################
|
#######################################
|
||||||
|
chat_integration_slack_username:
|
||||||
|
default: ''
|
||||||
chat_integration_slack_enabled:
|
chat_integration_slack_enabled:
|
||||||
default: false
|
default: false
|
||||||
validator: "ChatIntegrationSlackEnabledSettingValidator"
|
validator: "ChatIntegrationSlackEnabledSettingValidator"
|
||||||
|
@ -42,9 +42,16 @@ module DiscourseChat::Provider::SlackProvider
|
|||||||
"#{Discourse.base_url}#{url}"
|
"#{Discourse.base_url}#{url}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
slack_username =
|
||||||
|
if SiteSetting.chat_integration_slack_username.present?
|
||||||
|
SiteSetting.chat_integration_slack_username
|
||||||
|
else
|
||||||
|
SiteSetting.title || "Discourse"
|
||||||
|
end
|
||||||
|
|
||||||
message = {
|
message = {
|
||||||
channel: channel,
|
channel: channel,
|
||||||
username: SiteSetting.title || "Discourse",
|
username: slack_username,
|
||||||
icon_url: icon_url,
|
icon_url: icon_url,
|
||||||
attachments: []
|
attachments: []
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user