mirror of
https://github.com/discourse/discourse.git
synced 2024-12-23 01:03:47 +08:00
37942cb8bb
- Convert `admin-incoming-email` modal to component-based API - Testing that the modal was working in local development was extremely challenging due to the need for `rejected` and `bounced` emails. Something that is not easy to stub in a local dev environment. To make this process more smooth for future developers I have added a new rake task: ``` desc "Creates sample email logs" task "email_logs:populate" => ["db:load_config"] do |_, args| DiscourseDev::EmailLog.populate! end ``` That will generate fully functional email logs in development to be toyed with. <img width="787" alt="Screenshot 2023-07-20 at 3 27 04 PM" src="https://github.com/discourse/discourse/assets/50783505/47b3fe34-cd7e-49a5-8fe6-768c0fbd1aa2">
62 lines
1.6 KiB
Ruby
62 lines
1.6 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
desc "Creates sample categories"
|
|
task "groups:populate" => ["db:load_config"] do |_, args|
|
|
DiscourseDev::Group.populate!
|
|
end
|
|
|
|
desc "Creates sample user accounts"
|
|
task "users:populate" => ["db:load_config"] do |_, args|
|
|
DiscourseDev::User.populate!
|
|
end
|
|
|
|
desc "Creates sample categories"
|
|
task "categories:populate" => ["db:load_config"] do |_, args|
|
|
DiscourseDev::Category.populate!
|
|
end
|
|
|
|
desc "Creates sample tags"
|
|
task "tags:populate" => ["db:load_config"] do |_, args|
|
|
DiscourseDev::Tag.populate!
|
|
end
|
|
|
|
desc "Creates sample topics"
|
|
task "topics:populate" => ["db:load_config"] do |_, args|
|
|
if ENV["IGNORE_CURRENT_COUNT"] == "true"
|
|
DiscourseDev::Topic.populate!(ignore_current_count: true)
|
|
else
|
|
DiscourseDev::Topic.populate!
|
|
end
|
|
end
|
|
|
|
desc "Creates sample private messages"
|
|
task "private_messages:populate", [:recipient] => ["db:load_config"] do |_, args|
|
|
args.with_defaults(type: "string")
|
|
|
|
if !args[:recipient]
|
|
puts "ERROR: Expecting rake private_messages:populate[recipient]"
|
|
exit 1
|
|
end
|
|
|
|
DiscourseDev::Topic.populate!(
|
|
private_messages: true,
|
|
recipient: args[:recipient],
|
|
ignore_current_count: true,
|
|
)
|
|
end
|
|
|
|
desc "Create post revisions"
|
|
task "post_revisions:populate" => ["db:load_config"] do |_, args|
|
|
DiscourseDev::PostRevision.populate!
|
|
end
|
|
|
|
desc "Add replies to a topic"
|
|
task "replies:populate", %i[topic_id count] => ["db:load_config"] do |_, args|
|
|
DiscourseDev::Post.add_replies!(args)
|
|
end
|
|
|
|
desc "Creates sample email logs"
|
|
task "email_logs:populate" => ["db:load_config"] do |_, args|
|
|
DiscourseDev::EmailLog.populate!
|
|
end
|