mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 08:43:25 +08:00
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
|
self.score
|
||||||
end
|
end
|
||||||
|
|
||||||
def delete_user_actions(actions, require_reject_reason: false)
|
def delete_user_actions(actions, bundle = nil, require_reject_reason: false)
|
||||||
reject =
|
bundle ||=
|
||||||
actions.add_bundle(
|
actions.add_bundle(
|
||||||
"reject_user",
|
"reject_user",
|
||||||
icon: "user-times",
|
icon: "user-times",
|
||||||
label: "reviewables.actions.reject_user.title",
|
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.icon = "user-times"
|
||||||
a.label = "reviewables.actions.reject_user.delete.title"
|
a.label = "reviewables.actions.reject_user.delete.title"
|
||||||
a.require_reject_reason = require_reject_reason
|
a.require_reject_reason = require_reject_reason
|
||||||
a.description = "reviewables.actions.reject_user.delete.description"
|
a.description = "reviewables.actions.reject_user.delete.description"
|
||||||
end
|
end
|
||||||
|
|
||||||
actions.add(:delete_user_block, bundle: reject) do |a|
|
actions.add(:delete_user_block, bundle: bundle) do |a|
|
||||||
a.icon = "ban"
|
a.icon = "ban"
|
||||||
a.label = "reviewables.actions.reject_user.block.title"
|
a.label = "reviewables.actions.reject_user.block.title"
|
||||||
a.require_reject_reason = require_reject_reason
|
a.require_reject_reason = require_reject_reason
|
||||||
|
|
|
@ -44,28 +44,32 @@ class ReviewableFlaggedPost < Reviewable
|
||||||
return unless pending?
|
return unless pending?
|
||||||
return if post.blank?
|
return if post.blank?
|
||||||
|
|
||||||
agree =
|
agree_bundle =
|
||||||
actions.add_bundle("#{id}-agree", icon: "thumbs-up", label: "reviewables.actions.agree.title")
|
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?
|
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
|
end
|
||||||
|
|
||||||
if post.hidden?
|
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
|
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
|
end
|
||||||
|
|
||||||
if guardian.can_delete_post_or_topic?(post)
|
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
|
if post.reply_count > 0
|
||||||
build_action(
|
build_action(
|
||||||
actions,
|
actions,
|
||||||
:delete_and_agree_replies,
|
:delete_and_agree_replies,
|
||||||
icon: "far-trash-alt",
|
icon: "far-trash-alt",
|
||||||
bundle: agree,
|
bundle: agree_bundle,
|
||||||
confirm: true,
|
confirm: true,
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
@ -76,19 +80,21 @@ class ReviewableFlaggedPost < Reviewable
|
||||||
actions,
|
actions,
|
||||||
:agree_and_suspend,
|
:agree_and_suspend,
|
||||||
icon: "ban",
|
icon: "ban",
|
||||||
bundle: agree,
|
bundle: agree_bundle,
|
||||||
client_action: "suspend",
|
client_action: "suspend",
|
||||||
)
|
)
|
||||||
build_action(
|
build_action(
|
||||||
actions,
|
actions,
|
||||||
:agree_and_silence,
|
:agree_and_silence,
|
||||||
icon: "microphone-slash",
|
icon: "microphone-slash",
|
||||||
bundle: agree,
|
bundle: agree_bundle,
|
||||||
client_action: "silence",
|
client_action: "silence",
|
||||||
)
|
)
|
||||||
end
|
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?
|
if post.hidden?
|
||||||
build_action(actions, :disagree_and_restore, icon: "thumbs-down")
|
build_action(actions, :disagree_and_restore, icon: "thumbs-down")
|
||||||
else
|
else
|
||||||
|
@ -117,8 +123,6 @@ class ReviewableFlaggedPost < Reviewable
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
delete_user_actions(actions) if potential_spam? && guardian.can_delete_user?(target_created_by)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def perform_ignore(performed_by, args)
|
def perform_ignore(performed_by, args)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user