DEV: Move option to delete user under reviewable agree menu (#23199)
As per discussion, we want to move the options to delete the user under the "Yes" menu of the review queue, since these options are often the most recommended, but also frequently missed because they are tucked away under their own menu. In addition to the move, I removed the title case of the options so that it matches the other options in the "Yes" menu.
This commit is contained in:
parent
9238a9cf42
commit
12cdd7db1a
|
@ -656,22 +656,22 @@ class Reviewable < ActiveRecord::Base
|
|||
self.score
|
||||
end
|
||||
|
||||
def delete_user_actions(actions, require_reject_reason: false)
|
||||
reject =
|
||||
def delete_user_actions(actions, bundle = nil, require_reject_reason: false)
|
||||
bundle ||=
|
||||
actions.add_bundle(
|
||||
"reject_user",
|
||||
icon: "user-times",
|
||||
label: "reviewables.actions.reject_user.title",
|
||||
)
|
||||
|
||||
actions.add(:delete_user, bundle: reject) do |a|
|
||||
actions.add(:delete_user, bundle: bundle) do |a|
|
||||
a.icon = "user-times"
|
||||
a.label = "reviewables.actions.reject_user.delete.title"
|
||||
a.require_reject_reason = require_reject_reason
|
||||
a.description = "reviewables.actions.reject_user.delete.description"
|
||||
end
|
||||
|
||||
actions.add(:delete_user_block, bundle: reject) do |a|
|
||||
actions.add(:delete_user_block, bundle: bundle) do |a|
|
||||
a.icon = "ban"
|
||||
a.label = "reviewables.actions.reject_user.block.title"
|
||||
a.require_reject_reason = require_reject_reason
|
||||
|
|
|
@ -44,28 +44,32 @@ class ReviewableFlaggedPost < Reviewable
|
|||
return unless pending?
|
||||
return if post.blank?
|
||||
|
||||
agree =
|
||||
agree_bundle =
|
||||
actions.add_bundle("#{id}-agree", icon: "thumbs-up", label: "reviewables.actions.agree.title")
|
||||
|
||||
if potential_spam? && guardian.can_delete_user?(target_created_by)
|
||||
delete_user_actions(actions, agree_bundle)
|
||||
end
|
||||
|
||||
if !post.user_deleted? && !post.hidden?
|
||||
build_action(actions, :agree_and_hide, icon: "far-eye-slash", bundle: agree)
|
||||
build_action(actions, :agree_and_hide, icon: "far-eye-slash", bundle: agree_bundle)
|
||||
end
|
||||
|
||||
if post.hidden?
|
||||
build_action(actions, :agree_and_keep_hidden, icon: "thumbs-up", bundle: agree)
|
||||
build_action(actions, :agree_and_keep_hidden, icon: "thumbs-up", bundle: agree_bundle)
|
||||
else
|
||||
build_action(actions, :agree_and_keep, icon: "thumbs-up", bundle: agree)
|
||||
build_action(actions, :agree_and_keep, icon: "thumbs-up", bundle: agree_bundle)
|
||||
end
|
||||
|
||||
if guardian.can_delete_post_or_topic?(post)
|
||||
build_action(actions, :delete_and_agree, icon: "far-trash-alt", bundle: agree)
|
||||
build_action(actions, :delete_and_agree, icon: "far-trash-alt", bundle: agree_bundle)
|
||||
|
||||
if post.reply_count > 0
|
||||
build_action(
|
||||
actions,
|
||||
:delete_and_agree_replies,
|
||||
icon: "far-trash-alt",
|
||||
bundle: agree,
|
||||
bundle: agree_bundle,
|
||||
confirm: true,
|
||||
)
|
||||
end
|
||||
|
@ -76,19 +80,21 @@ class ReviewableFlaggedPost < Reviewable
|
|||
actions,
|
||||
:agree_and_suspend,
|
||||
icon: "ban",
|
||||
bundle: agree,
|
||||
bundle: agree_bundle,
|
||||
client_action: "suspend",
|
||||
)
|
||||
build_action(
|
||||
actions,
|
||||
:agree_and_silence,
|
||||
icon: "microphone-slash",
|
||||
bundle: agree,
|
||||
bundle: agree_bundle,
|
||||
client_action: "silence",
|
||||
)
|
||||
end
|
||||
|
||||
build_action(actions, :agree_and_restore, icon: "far-eye", bundle: agree) if post.user_deleted?
|
||||
if post.user_deleted?
|
||||
build_action(actions, :agree_and_restore, icon: "far-eye", bundle: agree_bundle)
|
||||
end
|
||||
if post.hidden?
|
||||
build_action(actions, :disagree_and_restore, icon: "thumbs-down")
|
||||
else
|
||||
|
@ -117,8 +123,6 @@ class ReviewableFlaggedPost < Reviewable
|
|||
)
|
||||
end
|
||||
end
|
||||
|
||||
delete_user_actions(actions) if potential_spam? && guardian.can_delete_user?(target_created_by)
|
||||
end
|
||||
|
||||
def perform_ignore(performed_by, args)
|
||||
|
|
Loading…
Reference in New Issue