From 4b52269827def8f53a397a3ad8915925d0adc555 Mon Sep 17 00:00:00 2001 From: Ted Johansson Date: Sun, 27 Aug 2023 10:05:05 +0800 Subject: [PATCH] DEV: Move option to delete user under reviewable reject menu (#23257) Follow-up to #23199 in which we moved the "delete user" options under the relevant action menu for flagged post. This change does the same, but to queued posts. --- .../components/reviewable-bundled-action.hbs | 6 +++++- .../stylesheets/common/base/reviewables.scss | 18 +++++++++-------- app/models/reviewable.rb | 1 - app/models/reviewable_queued_post.rb | 20 ++++++++++++++----- config/locales/server.en.yml | 2 ++ 5 files changed, 32 insertions(+), 15 deletions(-) diff --git a/app/assets/javascripts/discourse/app/components/reviewable-bundled-action.hbs b/app/assets/javascripts/discourse/app/components/reviewable-bundled-action.hbs index ffd767d5d28..6c1efeed032 100644 --- a/app/assets/javascripts/discourse/app/components/reviewable-bundled-action.hbs +++ b/app/assets/javascripts/discourse/app/components/reviewable-bundled-action.hbs @@ -1,6 +1,10 @@ {{#if this.multiple}} summary { + background-color: var(--success); + color: var(--secondary); + } + .reject-post, + .reject-post > summary { + background-color: var(--danger); + color: var(--secondary); } .reviewable-action, diff --git a/app/models/reviewable.rb b/app/models/reviewable.rb index a6738fb68ee..f489156671d 100644 --- a/app/models/reviewable.rb +++ b/app/models/reviewable.rb @@ -668,7 +668,6 @@ class Reviewable < ActiveRecord::Base 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: bundle) do |a| diff --git a/app/models/reviewable_queued_post.rb b/app/models/reviewable_queued_post.rb index 5b63aaf2ab7..827087f2efb 100644 --- a/app/models/reviewable_queued_post.rb +++ b/app/models/reviewable_queued_post.rb @@ -41,14 +41,24 @@ class ReviewableQueuedPost < Reviewable end if pending? - actions.add(:reject_post) do |a| - a.icon = "times" - a.label = "reviewables.actions.reject_post.title" + if guardian.can_delete_user?(target_created_by) + reject_bundle = + actions.add_bundle("#{id}-reject", label: "reviewables.actions.reject_post.title") + + actions.add(:reject_post, bundle: reject_bundle) do |a| + a.icon = "times" + a.label = "reviewables.actions.discard_post.title" + a.button_class = "reject-post" + end + delete_user_actions(actions, reject_bundle) + else + actions.add(:reject_post) do |a| + a.icon = "times" + a.label = "reviewables.actions.reject_post.title" + end end end - delete_user_actions(actions) if pending? && guardian.can_delete_user?(target_created_by) - actions.add(:delete) if guardian.can_delete?(self) end diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index 855e899c51d..fd51996f743 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -5206,6 +5206,8 @@ en: description: "Restore the post so that all users can see it." disagree: title: "No" + discard_post: + title: "Discard Post" ignore: title: "Ignore" ignore_and_do_nothing: