FIX: Old channel may be invalid.
This commit is contained in:
parent
c766a9cae9
commit
0cdb1d6538
|
@ -62,6 +62,7 @@ module Jobs
|
||||||
|
|
||||||
rows.each do |row|
|
rows.each do |row|
|
||||||
# Load an existing channel with this identifier. If none, create it
|
# 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
|
channel = DiscourseChat::Channel.with_provider('slack').with_data_value('identifier', row[:channel]).first
|
||||||
if !channel
|
if !channel
|
||||||
channel = DiscourseChat::Channel.create(provider: 'slack', data: { identifier: row[:channel] })
|
channel = DiscourseChat::Channel.create(provider: 'slack', data: { identifier: row[:channel] })
|
||||||
|
|
|
@ -62,7 +62,7 @@ RSpec.describe Jobs::DiscourseChatMigrateFromSlackOfficial do
|
||||||
plugin_name: 'discourse-slack-official',
|
plugin_name: 'discourse-slack-official',
|
||||||
key: "category_*",
|
key: "category_*",
|
||||||
type_name: "JSON",
|
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
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue