diff --git a/app/jobs/onceoff/migrate_from_slack_official.rb b/app/jobs/onceoff/migrate_from_slack_official.rb index 19c9b4c..f250efd 100644 --- a/app/jobs/onceoff/migrate_from_slack_official.rb +++ b/app/jobs/onceoff/migrate_from_slack_official.rb @@ -62,6 +62,7 @@ module Jobs rows.each do |row| # Load an existing channel with this identifier. If none, create it + row[:channel] = "##{row[:channel]}" unless row[:channel].start_with?("#") channel = DiscourseChat::Channel.with_provider('slack').with_data_value('identifier', row[:channel]).first if !channel channel = DiscourseChat::Channel.create(provider: 'slack', data: { identifier: row[:channel] }) diff --git a/spec/jobs/onceoff/migrate_from_slack_official_spec.rb b/spec/jobs/onceoff/migrate_from_slack_official_spec.rb index 715e455..534b7ea 100644 --- a/spec/jobs/onceoff/migrate_from_slack_official_spec.rb +++ b/spec/jobs/onceoff/migrate_from_slack_official_spec.rb @@ -62,7 +62,7 @@ RSpec.describe Jobs::DiscourseChatMigrateFromSlackOfficial do plugin_name: 'discourse-slack-official', key: "category_*", type_name: "JSON", - value: "[{\"channel\":\"#channel1\",\"filter\":\"watch\"},{\"channel\":\"#channel2\",\"filter\":\"follow\"},{\"channel\":\"#channel1\",\"filter\":\"mute\"}]" + value: "[{\"channel\":\"#channel1\",\"filter\":\"watch\"},{\"channel\":\"channel2\",\"filter\":\"follow\"},{\"channel\":\"#channel1\",\"filter\":\"mute\"}]" ) end