FIX: Old channel may be invalid.

This commit is contained in:
Guo Xiang Tan 2017-10-20 20:21:02 +08:00
parent c766a9cae9
commit 0cdb1d6538
2 changed files with 2 additions and 1 deletions

View File

@ -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] })

View File

@ -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