Skip to content

A platform for community discussion. Free, open, simple.

DEV: Move option to delete user under reviewable reject menu (#23257)

Ted Johansson4b52269827de
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}}
<DropdownSelectBox
- @class="reviewable-action-dropdown btn-icon-text"
+ @class={{concat-class
+ "reviewable-action-dropdown btn-icon-text"
+ (dasherize this.first.id)
+ this.first.button_class
+ }}
@nameProperty="label"
@content={{this.bundle.actions}}
@onChange={{action "performById"}}
diff --git a/app/assets/stylesheets/common/base/reviewables.scss b/app/assets/stylesheets/common/base/reviewables.scss
index 6af43395c14..b3003c76753 100644
--- a/app/assets/stylesheets/common/base/reviewables.scss
+++ b/app/assets/stylesheets/common/base/reviewables.scss
@@ -273,15 +273,17 @@
button {
white-space: nowrap;
+ }
- &.approve-post {
- background-color: var(--success);
- color: var(--secondary);
- }
- &.reject-post {
- background-color: var(--danger);
- color: var(--secondary);
- }
+ .approve-post,
+ .approve-post > 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: