FIX: Fix narrative bot settings in multisites (#12380)
after_initialize is not called for each multisite database, but just for first (default) database.
This commit is contained in:
parent
16b5fa030b
commit
50f8782def
|
@ -48,12 +48,16 @@ after_initialize do
|
||||||
'../lib/discourse_narrative_bot/welcome_post_type_site_setting.rb'
|
'../lib/discourse_narrative_bot/welcome_post_type_site_setting.rb'
|
||||||
].each { |path| load File.expand_path(path, __FILE__) }
|
].each { |path| load File.expand_path(path, __FILE__) }
|
||||||
|
|
||||||
|
RailsMultisite::ConnectionManagement.each_connection do
|
||||||
|
if SiteSetting.discourse_narrative_bot_enabled
|
||||||
# Disable welcome message because that is what the bot is supposed to replace.
|
# Disable welcome message because that is what the bot is supposed to replace.
|
||||||
SiteSetting.send_welcome_message = false if SiteSetting.send_welcome_message
|
SiteSetting.send_welcome_message = false
|
||||||
|
|
||||||
certificate_path = "#{Discourse.base_url}/discobot/certificate.svg"
|
certificate_path = "#{Discourse.base_url}/discobot/certificate.svg"
|
||||||
if SiteSetting.discourse_narrative_bot_enabled && !SiteSetting.allowed_iframes.include?(certificate_path)
|
if !SiteSetting.allowed_iframes.include?(certificate_path)
|
||||||
SiteSetting.allowed_iframes = SiteSetting.allowed_iframes.split('|').append("#{Discourse.base_url}/discobot/certificate.svg").join('|')
|
SiteSetting.allowed_iframes = SiteSetting.allowed_iframes.split('|').append(certificate_path).join('|')
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
require_dependency 'plugin_store'
|
require_dependency 'plugin_store'
|
||||||
|
|
Loading…
Reference in New Issue