parent
1b8d06c57c
commit
2b357b2dfe
|
@ -41,10 +41,10 @@ module DiscourseChat
|
|||
)
|
||||
|
||||
icon_url =
|
||||
if !SiteSetting.chat_integration_hipchat_icon_url.blank?
|
||||
if SiteSetting.chat_integration_hipchat_icon_url.present?
|
||||
UrlHelper.absolute(SiteSetting.chat_integration_hipchat_icon_url)
|
||||
elsif !SiteSetting.logo_small_url.blank?
|
||||
UrlHelper.absolute(SiteSetting.logo_small_url)
|
||||
elsif (url = (SiteSetting.try(:site_logo_small_url) || SiteSetting.logo_small_url)).present?
|
||||
UrlHelper.absolute(url)
|
||||
end
|
||||
|
||||
message = {
|
||||
|
|
|
@ -44,10 +44,10 @@ module DiscourseChat
|
|||
end
|
||||
|
||||
icon_url =
|
||||
if !SiteSetting.chat_integration_mattermost_icon_url.blank?
|
||||
if SiteSetting.chat_integration_mattermost_icon_url.present?
|
||||
UrlHelper.absolute(SiteSetting.chat_integration_mattermost_icon_url)
|
||||
elsif !SiteSetting.logo_small_url.blank?
|
||||
UrlHelper.absolute(SiteSetting.logo_small_url)
|
||||
elsif (url = (SiteSetting.try(:site_logo_small_url) || SiteSetting.logo_small_url)).present?
|
||||
UrlHelper.absolute(url)
|
||||
end
|
||||
|
||||
message = {
|
||||
|
|
|
@ -32,10 +32,10 @@ module DiscourseChat::Provider::SlackProvider
|
|||
end
|
||||
|
||||
icon_url =
|
||||
if !SiteSetting.chat_integration_slack_icon_url.blank?
|
||||
if SiteSetting.chat_integration_slack_icon_url.present?
|
||||
"#{Discourse.base_url}#{SiteSetting.chat_integration_slack_icon_url}"
|
||||
elsif !SiteSetting.logo_small_url.blank?
|
||||
"#{Discourse.base_url}#{SiteSetting.logo_small_url}"
|
||||
elsif (url = (SiteSetting.try(:site_logo_small_url) || SiteSetting.logo_small_url)).present?
|
||||
"#{Discourse.base_url}#{url}"
|
||||
end
|
||||
|
||||
message = {
|
||||
|
|
|
@ -4,10 +4,12 @@ RSpec.describe DiscourseChat::Provider::MattermostProvider do
|
|||
let(:post) { Fabricate(:post) }
|
||||
|
||||
describe '.trigger_notifications' do
|
||||
let(:upload) { Fabricate(:upload) }
|
||||
|
||||
before do
|
||||
SiteSetting.chat_integration_mattermost_enabled = true
|
||||
SiteSetting.chat_integration_mattermost_webhook_url = "https://mattermost.blah/hook/abcd"
|
||||
SiteSetting.logo_small_url = "https://some_small_logo"
|
||||
SiteSetting.logo_small = upload
|
||||
end
|
||||
|
||||
let(:chan1) { DiscourseChat::Channel.create!(provider: 'mattermost', data: { identifier: "#awesomechannel" }) }
|
||||
|
@ -21,7 +23,7 @@ RSpec.describe DiscourseChat::Provider::MattermostProvider do
|
|||
describe 'when mattermost icon is not configured' do
|
||||
it 'defaults to the right icon' do
|
||||
message = described_class.mattermost_message(post, chan1)
|
||||
expect(message[:icon_url]).to eq(SiteSetting.logo_small_url)
|
||||
expect(message[:icon_url]).to eq(UrlHelper.absolute(upload.url))
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue