mirror of
https://github.com/discourse/discourse.git
synced 2025-02-07 11:58:27 +00:00
111a502231
"Rejecting" a user in the queue is equivalent to deleting them, which would then making it impossible to review rejected users. Now we store information about the user in the payload so if they are deleted things still display in the Rejected view. Secondly, if a user is destroyed outside of the review queue, it will now automatically "Reject" that queue item.
27 lines
651 B
Ruby
27 lines
651 B
Ruby
class Jobs::CreateUserReviewable < Jobs::Base
|
|
def execute(args)
|
|
raise Discourse::InvalidParameters unless args[:user_id].present?
|
|
|
|
if user = User.find_by(id: args[:user_id])
|
|
return if user.approved?
|
|
|
|
reviewable = ReviewableUser.create!(
|
|
target: user,
|
|
created_by: Discourse.system_user,
|
|
reviewable_by_moderator: true,
|
|
payload: {
|
|
username: user.username,
|
|
name: user.name,
|
|
email: user.email
|
|
}
|
|
)
|
|
reviewable.add_score(
|
|
Discourse.system_user,
|
|
ReviewableScore.types[:needs_approval],
|
|
force_review: true
|
|
)
|
|
end
|
|
|
|
end
|
|
end
|