DEV: Extend the reviewables:populate rake task in chat (#30597)

Related to 5a55c9062a

The chat plugin now makes use of the plugin API that was added in the linked commit for extending the reviewables:populate rake task.
This commit is contained in:
Osama Sayegh
2025-01-07 03:05:34 +03:00
committed by GitHub
parent 9c7b0ddb2f
commit 2d424676fc
3 changed files with 35 additions and 2 deletions

View File

@ -0,0 +1,21 @@
# frozen_string_literal: true
module DiscourseDev
class ReviewableMessage < Reviewable
def populate!
channel = CategoryChannel.new.create!
message = Message.new(channel_id: channel.id, count: 1).create!
user = @users.sample
::Chat::FlagMessage.call(
guardian: user.guardian,
params: {
channel_id: channel.id,
message_id: message.id,
flag_type_id:
ReviewableScore.types.slice(:off_topic, :inappropriate, :spam, :illegal).values.sample,
},
)
end
end
end