discourse/lib/discourse_dev/reviewable_queued_post.rb
Osama Sayegh 5a55c9062a
DEV: Add reviewables:populate rake task (#30540)
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.
2025-01-03 10:05:04 +08:00

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