More improvements to migration script.
This commit is contained in:
parent
2d6737ce5c
commit
1a3928b803
|
@ -1,8 +1,7 @@
|
||||||
module Jobs
|
module Jobs
|
||||||
class DiscourseChatMigrateFromSlackOfficial < Jobs::Onceoff
|
class DiscourseChatMigrateFromSlackOfficial < Jobs::Onceoff
|
||||||
def execute_onceoff(args)
|
def execute_onceoff(args)
|
||||||
# Check if slack plugin is installed by testing if the sitesetting exists
|
slack_installed = PluginStoreRow.where(plugin_name: 'discourse-slack-official').exists?
|
||||||
slack_installed = defined?(DiscourseSlack)
|
|
||||||
|
|
||||||
if slack_installed
|
if slack_installed
|
||||||
already_setup_rules = DiscourseChat::Channel.with_provider('slack').exists?
|
already_setup_rules = DiscourseChat::Channel.with_provider('slack').exists?
|
||||||
|
@ -17,9 +16,13 @@ module Jobs
|
||||||
ActiveRecord::Base.transaction do
|
ActiveRecord::Base.transaction do
|
||||||
migrate_settings
|
migrate_settings
|
||||||
migrate_data
|
migrate_data
|
||||||
SiteSetting.slack_enabled = false
|
is_slack_enabled = SiteSetting.slack_enabled
|
||||||
SiteSetting.chat_integration_slack_enabled = true
|
|
||||||
SiteSetting.chat_integration_enabled = true
|
if is_slack_enabled
|
||||||
|
SiteSetting.slack_enabled = false
|
||||||
|
SiteSetting.chat_integration_slack_enabled = true
|
||||||
|
SiteSetting.chat_integration_enabled = true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue