diff --git a/app/controllers/api/v1/admin/reports_controller.rb b/app/controllers/api/v1/admin/reports_controller.rb index 9dfb181a28..bed4be922a 100644 --- a/app/controllers/api/v1/admin/reports_controller.rb +++ b/app/controllers/api/v1/admin/reports_controller.rb @@ -40,29 +40,37 @@ class Api::V1::Admin::ReportsController < Api::BaseController def assign_to_self authorize @report, :update? - @report.update!(assigned_account_id: current_account.id) - log_action :assigned_to_self, @report + unless @report.assigned_account_id == current_account.id + @report.update!(assigned_account_id: current_account.id) + log_action :assigned_to_self, @report + end render json: @report, serializer: REST::Admin::ReportSerializer end def unassign authorize @report, :update? - @report.update!(assigned_account_id: nil) - log_action :unassigned, @report + if @report.assigned_account_id + @report.update!(assigned_account_id: nil) + log_action :unassigned, @report + end render json: @report, serializer: REST::Admin::ReportSerializer end def reopen authorize @report, :update? - @report.unresolve! - log_action :reopen, @report + unless @report.unresolved? + @report.unresolve! + log_action :reopen, @report + end render json: @report, serializer: REST::Admin::ReportSerializer end def resolve authorize @report, :update? - @report.resolve!(current_account) - log_action :resolve, @report + unless @report.action_taken? + @report.resolve!(current_account) + log_action :resolve, @report + end render json: @report, serializer: REST::Admin::ReportSerializer end