1
0
Fork 0
mirror of https://github.com/mastodon/mastodon.git synced 2024-08-20 21:08:15 -07:00

Only log report actions when state changes

This commit is contained in:
trwnh 2022-11-08 23:24:15 -06:00 committed by GitHub
parent 0222970ab2
commit f6901a2c7e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -40,29 +40,37 @@ class Api::V1::Admin::ReportsController < Api::BaseController
def assign_to_self
authorize @report, :update?
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?
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?
unless @report.unresolved?
@report.unresolve!
log_action :reopen, @report
end
render json: @report, serializer: REST::Admin::ReportSerializer
end
def resolve
authorize @report, :update?
unless @report.action_taken?
@report.resolve!(current_account)
log_action :resolve, @report
end
render json: @report, serializer: REST::Admin::ReportSerializer
end