Remove dev dugging commands.

This commit is contained in:
Guo Xiang Tan 2017-10-03 15:16:09 +08:00
parent b33fb671f2
commit f6e9fe9eb7
1 changed files with 1 additions and 11 deletions

View File

@ -27,8 +27,6 @@ module Jobs
end end
def migrate_data def migrate_data
in_console = Rails.const_defined? 'Console'
rows = [] rows = []
PluginStoreRow.where(plugin_name: 'discourse-slack-official') PluginStoreRow.where(plugin_name: 'discourse-slack-official')
.where("key ~* :pat", pat: "^category_.*") .where("key ~* :pat", pat: "^category_.*")
@ -61,24 +59,18 @@ module Jobs
if !channel if !channel
channel = DiscourseChat::Channel.create(provider: 'slack', data: { identifier: row[:channel] }) channel = DiscourseChat::Channel.create(provider: 'slack', data: { identifier: row[:channel] })
if !channel.id if !channel.id
puts "Error creating channel for #{row}" if in_console Rails.logger.warn("Error creating channel for #{row}")
next next
end end
end end
# Create the rule, with clever logic for avoiding duplicates # Create the rule, with clever logic for avoiding duplicates
success = DiscourseChat::Helper.smart_create_rule(channel: channel, filter: row[:filter], category_id: row[:category_id], tags: row[:tags]) success = DiscourseChat::Helper.smart_create_rule(channel: channel, filter: row[:filter], category_id: row[:category_id], tags: row[:tags])
if in_console
puts (success ? "Success creating #{row}" : "Error creating #{row}")
end
end end
end end
def migrate_settings def migrate_settings
in_console = Rails.const_defined? 'Console'
SiteSetting.chat_integration_slack_access_token = SiteSetting.slack_access_token SiteSetting.chat_integration_slack_access_token = SiteSetting.slack_access_token
SiteSetting.chat_integration_slack_incoming_webhook_token = SiteSetting.slack_incoming_webhook_token SiteSetting.chat_integration_slack_incoming_webhook_token = SiteSetting.slack_incoming_webhook_token
SiteSetting.chat_integration_slack_excerpt_length = SiteSetting.slack_discourse_excerpt_length SiteSetting.chat_integration_slack_excerpt_length = SiteSetting.slack_discourse_excerpt_length
@ -86,8 +78,6 @@ module Jobs
SiteSetting.chat_integration_slack_icon_url = SiteSetting.slack_icon_url SiteSetting.chat_integration_slack_icon_url = SiteSetting.slack_icon_url
SiteSetting.chat_integration_delay_seconds = SiteSetting.post_to_slack_window_secs SiteSetting.chat_integration_delay_seconds = SiteSetting.post_to_slack_window_secs
SiteSetting.chat_integration_discourse_username = SiteSetting.slack_discourse_username SiteSetting.chat_integration_discourse_username = SiteSetting.slack_discourse_username
puts "Site Settings migrated" if in_console
end end
end end