FEATURE: Allow `[quote]` to be disabled for slack transcripts (#120)
https://meta.discourse.org/t/222145
This commit is contained in:
parent
3900586557
commit
cd6e4a8b62
|
@ -14,6 +14,7 @@ en:
|
||||||
chat_integration_slack_excerpt_length: 'Slack post excerpt length'
|
chat_integration_slack_excerpt_length: 'Slack post excerpt length'
|
||||||
chat_integration_slack_icon_url: 'Icon to post to slack with (defaults to forum logo)'
|
chat_integration_slack_icon_url: 'Icon to post to slack with (defaults to forum logo)'
|
||||||
chat_integration_slack_outbound_webhook_url: "For using Slack's 'Incoming Webhook' system instead of of the OAuth API. Not recommended."
|
chat_integration_slack_outbound_webhook_url: "For using Slack's 'Incoming Webhook' system instead of of the OAuth API. Not recommended."
|
||||||
|
chat_integration_slack_transcript_quote: Wrap slack transcript in [quote] tags?
|
||||||
|
|
||||||
errors:
|
errors:
|
||||||
chat_integration_slack_api_configs_are_empty: "You must enter either an outbound webhook URL, or an access token"
|
chat_integration_slack_api_configs_are_empty: "You must enter either an outbound webhook URL, or an access token"
|
||||||
|
|
|
@ -26,6 +26,8 @@ chat_integration:
|
||||||
regex: '^https:\/\/hooks\.slack\.com\/services\/.+$'
|
regex: '^https:\/\/hooks\.slack\.com\/services\/.+$'
|
||||||
chat_integration_slack_icon_url:
|
chat_integration_slack_icon_url:
|
||||||
default: ''
|
default: ''
|
||||||
|
chat_integration_slack_transcript_quote:
|
||||||
|
default: true
|
||||||
|
|
||||||
#######################################
|
#######################################
|
||||||
######### TELEGRAM SETTINGS ###########
|
######### TELEGRAM SETTINGS ###########
|
||||||
|
|
|
@ -82,7 +82,8 @@ module DiscourseChatIntegration::Provider::SlackProvider
|
||||||
end
|
end
|
||||||
|
|
||||||
def build_transcript
|
def build_transcript
|
||||||
post_content = +"[quote]\n"
|
post_content = +""
|
||||||
|
post_content << "[quote]\n" if SiteSetting.chat_integration_slack_transcript_quote
|
||||||
post_content << "[**#{I18n.t('chat_integration.provider.slack.transcript.view_on_slack', name: @channel_name)}**](#{first_message.url})\n"
|
post_content << "[**#{I18n.t('chat_integration.provider.slack.transcript.view_on_slack', name: @channel_name)}**](#{first_message.url})\n"
|
||||||
|
|
||||||
all_avatars = {}
|
all_avatars = {}
|
||||||
|
@ -114,7 +115,8 @@ module DiscourseChatIntegration::Provider::SlackProvider
|
||||||
post_content << "\n"
|
post_content << "\n"
|
||||||
end
|
end
|
||||||
|
|
||||||
post_content << "[/quote]\n\n"
|
post_content << "[/quote]" if SiteSetting.chat_integration_slack_transcript_quote
|
||||||
|
post_content << "\n\n"
|
||||||
|
|
||||||
all_avatars.each do |username, url|
|
all_avatars.each do |username, url|
|
||||||
post_content << "[#{username}]: #{url}\n"
|
post_content << "[#{username}]: #{url}\n"
|
||||||
|
|
|
@ -317,6 +317,20 @@ RSpec.describe DiscourseChatIntegration::Provider::SlackProvider::SlackTranscrip
|
||||||
expect(text).to eq(expected)
|
expect(text).to eq(expected)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'omits quote tags when disabled' do
|
||||||
|
transcript.set_last_message_by_index(1)
|
||||||
|
|
||||||
|
text = transcript.build_transcript
|
||||||
|
expect(text).to include("[quote]")
|
||||||
|
expect(text).to include("[/quote]")
|
||||||
|
|
||||||
|
SiteSetting.chat_integration_slack_transcript_quote = false
|
||||||
|
|
||||||
|
text = transcript.build_transcript
|
||||||
|
expect(text).not_to include("[quote]")
|
||||||
|
expect(text).not_to include("[/quote]")
|
||||||
|
end
|
||||||
|
|
||||||
it 'creates the slack UI correctly' do
|
it 'creates the slack UI correctly' do
|
||||||
transcript.set_last_message_by_index(1)
|
transcript.set_last_message_by_index(1)
|
||||||
ui = transcript.build_slack_ui
|
ui = transcript.build_slack_ui
|
||||||
|
|
Loading…
Reference in New Issue