mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-03 08:18:42 +08:00
The staff action log records moderation actions (post deletions, user suspensions, silences, user approvals, etc.) as `UserHistory` rows, but entries triggered from the reviewable queue have no reference back to the reviewable that caused them. When auditing a decision in the log, staff can't jump to the flagged post, queued post, or user-approval review that produced it. Link to review is visible in the log: <img width="900" height="674" alt="Screenshot 2026-04-24 at 2 17 04 pm" src="https://github.com/user-attachments/assets/791ebc58-0a4d-4c2c-a363-efe482f5f755" />
31 lines
737 B
Ruby
31 lines
737 B
Ruby
# frozen_string_literal: true
|
|
|
|
class User::Action::SuspendAll < Service::ActionBase
|
|
option :users, []
|
|
option :actor
|
|
option :params
|
|
|
|
delegate :message, :post_id, :suspend_until, :reason, :reviewable_id, to: :params, private: true
|
|
|
|
def call
|
|
suspended_users.first.try(:user_history).try(:details)
|
|
end
|
|
|
|
private
|
|
|
|
def suspended_users
|
|
users.map do |user|
|
|
UserSuspender.new(
|
|
user,
|
|
suspended_till: suspend_until,
|
|
reason: reason,
|
|
by_user: actor,
|
|
message: message,
|
|
post_id: post_id,
|
|
reviewable_id: reviewable_id,
|
|
).tap(&:suspend)
|
|
rescue => err
|
|
Discourse.warn_exception(err, message: "failed to suspend user with ID #{user.id}")
|
|
end
|
|
end
|
|
end
|