2023-04-20 08:53:10 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
if Discourse.allow_dev_populate?
|
|
|
|
desc "Generates sample messages in channels"
|
|
|
|
task "chat:message:populate", %i[channel_id count] => ["db:load_config"] do |_, args|
|
2024-11-14 01:11:25 +08:00
|
|
|
DiscourseDev::Message.populate!(channel_id: args[:channel_id], count: args[:count])
|
2023-04-20 08:53:10 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
desc "Generates random channels from categories"
|
|
|
|
task "chat:category_channel:populate" => ["db:load_config"] do |_, args|
|
2024-11-14 01:11:25 +08:00
|
|
|
DiscourseDev::CategoryChannel.populate!
|
2023-04-20 08:53:10 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
desc "Creates a thread with sample messages in a channel"
|
2024-11-14 01:11:25 +08:00
|
|
|
task "chat:thread:populate", %i[channel_id count] => ["db:load_config"] do |_, args|
|
|
|
|
DiscourseDev::Thread.populate!(channel_id: args[:channel_id], count: args[:count])
|
2023-04-20 08:53:10 +08:00
|
|
|
end
|
|
|
|
end
|