mirror of
https://github.com/discourse/discourse.git
synced 2025-01-16 15:52:45 +08:00
5a55c9062a
Adds a new reviewables:populate rake task that works in a similar fashion to the existing *:populate rake tasks. The rake task creates pending reviewable of all core types, with possibility for plugins to extend the task to populate their own reviewable types.
28 lines
807 B
Ruby
28 lines
807 B
Ruby
# frozen_string_literal: true
|
|
|
|
require "discourse_dev/reviewable"
|
|
require "faker"
|
|
|
|
module DiscourseDev
|
|
class ReviewableQueuedPost < Reviewable
|
|
def populate!
|
|
2.times do
|
|
topic = @topics.sample
|
|
manager =
|
|
NewPostManager.new(
|
|
@users.sample,
|
|
{
|
|
topic_id: topic.id,
|
|
raw: Faker::DiscourseMarkdown.sandwich(sentences: 3),
|
|
tags: nil,
|
|
typing_duration_msecs: Faker::Number.between(from: 2_000, to: 5_000),
|
|
composer_open_duration_msecs: Faker::Number.between(from: 5_500, to: 10_000),
|
|
reply_to_post_number: topic.posts.sample.post_number,
|
|
},
|
|
)
|
|
manager.enqueue(:watched_word, creator_opts: { skip_validations: true })
|
|
end
|
|
end
|
|
end
|
|
end
|