mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: Reason and deleted content support in the review queue (#30295)
Add flag reason filter and improve handling of deleted content in review queue This commit enhances the review queue with several key improvements: 1. Adds a new "Reason" filter to allow filtering flags by their score type 2. Improves UI for deleted content by: - Adding visual indication for deleted posts (red background) - Properly handling deleted content visibility for staff (category mods can not see deleted content) 3. Refactors reviewable score type handling for better code organization 4. Adds tests for trashed topics/posts visibility This change will help moderators more efficiently manage the review queue by being able to focus on specific types of flags and better identify deleted content.
This commit is contained in:
@@ -8,6 +8,10 @@ class ReviewablesController < ApplicationController
|
||||
before_action :version_required, only: %i[update perform]
|
||||
before_action :ensure_can_see, except: [:destroy]
|
||||
|
||||
around_action :with_deleted_content,
|
||||
only: %i[index show],
|
||||
if: ->(controller) { controller.guardian.is_staff? }
|
||||
|
||||
def index
|
||||
offset = params[:offset].to_i
|
||||
|
||||
@@ -41,6 +45,7 @@ class ReviewablesController < ApplicationController
|
||||
type
|
||||
sort_order
|
||||
flagged_by
|
||||
score_type
|
||||
].each { |filter_key| filters[filter_key] = params[filter_key] }
|
||||
|
||||
total_rows = Reviewable.list_for(current_user, **filters).count
|
||||
@@ -69,6 +74,11 @@ class ReviewablesController < ApplicationController
|
||||
total_rows_reviewables: total_rows,
|
||||
types: meta_types,
|
||||
reviewable_types: Reviewable.types,
|
||||
score_types:
|
||||
ReviewableScore
|
||||
.types
|
||||
.filter { |k, v| k != :notify_user }
|
||||
.map { |k, v| { id: v, name: ReviewableScore.type_title(k) } },
|
||||
reviewable_count: current_user.reviewable_count,
|
||||
unseen_reviewable_count: Reviewable.unseen_reviewable_count(current_user),
|
||||
),
|
||||
@@ -318,4 +328,8 @@ class ReviewablesController < ApplicationController
|
||||
def ensure_can_see
|
||||
Guardian.new(current_user).ensure_can_see_review_queue!
|
||||
end
|
||||
|
||||
def with_deleted_content
|
||||
Post.unscoped { Topic.unscoped { PostAction.unscoped { yield } } }
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user