Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions app/controllers/admin/projects_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class Admin::ProjectsController < Admin::ApplicationController
REVIEW_SCREEN_ACTIONS = %i[review repo_tree commit_stats changes_since_review ai_requirements_check ai_requirements_check_status].freeze

before_action :require_projects_permission!, except: REVIEW_SCREEN_ACTIONS
before_action :require_projects_permission!, except: REVIEW_SCREEN_ACTIONS + [ :unflag_for_review ]
before_action :require_review_screen_access!, only: REVIEW_SCREEN_ACTIONS
before_action :set_project, only: [ :show, :review, :destroy, :restore, :toggle_hidden, :toggle_shadow_ban, :toggle_staff_pick, :change_tier, :add_note, :destroy_note, :update_note, :flag_for_review, :unflag_for_review, :mark_unbuilt, :reverse_review, :ai_requirements_check, :ai_requirements_check_status, :repo_tree, :commit_stats, :changes_since_review, :send_checkpoint_message, :send_dm_message ]

Expand Down Expand Up @@ -344,10 +344,8 @@ def flag_for_review
end

def unflag_for_review
authorize @project, :review?

unless current_user.superadmin?
redirect_back fallback_location: admin_review_path(@project), alert: "Only superadmins can clear a review flag."
unless current_user.superadmin? || current_user.has_permission?("fraud")
redirect_back fallback_location: admin_review_path(@project), alert: "Only superadmins or fraud reviewers can clear a review flag."
return
end

Expand Down
3 changes: 2 additions & 1 deletion app/controllers/admin/reviews_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ def show
can: {
review: can_review,
requirements_check: policy(@project).requirements_check?,
claim: !can_review || claim[:locked_by].nil? || current_user.superadmin?
claim: !can_review || claim[:locked_by].nil? || current_user.superadmin?,
unflag: current_user.superadmin? || current_user.has_permission?("fraud")
},
claim: claim,
session_stats: current_user.superadmin? ? session_stats(@project) : nil,
Expand Down
4 changes: 2 additions & 2 deletions app/javascript/pages/Admin/Reviews/Show.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export default function AdminReviewsShow({
reviewer: Reviewer
review_history: ReviewEvent[]
notes: ReviewNote[]
can: { review: boolean; requirements_check: boolean; claim: boolean }
can: { review: boolean; requirements_check: boolean; claim: boolean; unflag: boolean }
claim: ClaimState
session_stats: SessionStats | null
checkpoint_channel_configured: boolean
Expand Down Expand Up @@ -684,7 +684,7 @@ export default function AdminReviewsShow({
<FlagBanner
reason={project.flag_reason}
flaggedBy={project.flagged_by_name}
canUnflag={reviewer.is_superadmin}
canUnflag={can.unflag}
onUnflag={unflag}
unflagging={unflagging}
/>
Expand Down
Loading