FEATURE: Add Matrix option for using plain text instead of notice (#25)

Notices are problematic on certain IRC clients and lead to bans
if the Matrix channel is bridged to IRC.
This commit is contained in:
Tisza Gergő 2018-12-28 15:44:43 -08:00 committed by David Taylor
parent 1a08d64785
commit bf1939f08d
3 changed files with 4 additions and 1 deletions

View File

@ -55,6 +55,7 @@ en:
chat_integration_matrix_homeserver: "Homeserver to connect to. Make sure to include the protocol" chat_integration_matrix_homeserver: "Homeserver to connect to. Make sure to include the protocol"
chat_integration_matrix_access_token: "Access token for the bot's Matrix account" chat_integration_matrix_access_token: "Access token for the bot's Matrix account"
chat_integration_matrix_excerpt_length: "Matrix post excerpt length" chat_integration_matrix_excerpt_length: "Matrix post excerpt length"
chat_integration_matrix_use_notice: "Use notice instead of plain message"
####################################### #######################################
########### ZULIP SETTINGS ############ ########### ZULIP SETTINGS ############

View File

@ -85,6 +85,8 @@ chat_integration:
default: '' default: ''
chat_integration_matrix_excerpt_length: chat_integration_matrix_excerpt_length:
default: 400 default: 400
chat_integration_matrix_use_notice:
default: true
####################################### #######################################
########### ZULIP SETTINGS ############ ########### ZULIP SETTINGS ############

View File

@ -39,7 +39,7 @@ module DiscourseChat
end end
message = { message = {
msgtype: 'm.notice', msgtype: SiteSetting.chat_integration_matrix_use_notice ? 'm.notice' : 'm.text',
body: I18n.t('chat_integration.provider.matrix.text_message', user: display_name, body: I18n.t('chat_integration.provider.matrix.text_message', user: display_name,
post_url: post.full_url, post_url: post.full_url,
title: post.topic.title), title: post.topic.title),