Fix the build.
This commit is contained in:
parent
3eb8e97f37
commit
cef085d0b6
|
@ -1,13 +1,22 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
event =
|
|
||||||
if Gem::Version.new(Discourse::VERSION::STRING) > Gem::Version.new("2.3.0.beta8")
|
if Gem::Version.new(Discourse::VERSION::STRING) > Gem::Version.new("2.3.0.beta8")
|
||||||
:site_setting_changed
|
DiscourseEvent.on(:site_setting_changed) do |setting_name, old_value, new_value|
|
||||||
else
|
isEnabledSetting = setting_name == 'chat_integration_telegram_enabled'
|
||||||
:site_setting_saved
|
isAccessToken = setting_name == 'chat_integration_telegram_access_token'
|
||||||
end
|
|
||||||
|
|
||||||
DiscourseEvent.on(event) do |sitesetting|
|
if (isEnabledSetting || isAccessToken)
|
||||||
|
enabled = isEnabledSetting ? new_value == true : SiteSetting.chat_integration_telegram_enabled
|
||||||
|
|
||||||
|
if enabled
|
||||||
|
Scheduler::Defer.later("Setup Telegram Webhook") do
|
||||||
|
DiscourseChat::Provider::TelegramProvider.setup_webhook()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
DiscourseEvent.on(site_setting_saved) do |sitesetting|
|
||||||
isEnabledSetting = sitesetting.name == 'chat_integration_telegram_enabled'
|
isEnabledSetting = sitesetting.name == 'chat_integration_telegram_enabled'
|
||||||
isAccessToken = sitesetting.name == 'chat_integration_telegram_access_token'
|
isAccessToken = sitesetting.name == 'chat_integration_telegram_access_token'
|
||||||
|
|
||||||
|
@ -20,3 +29,4 @@ DiscourseEvent.on(event) do |sitesetting|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
Loading…
Reference in New Issue