mirror of https://github.com/mastodon/mastodon.git
Only log report actions when state changes
parent
0222970ab2
commit
f6901a2c7e
|
@ -40,29 +40,37 @@ class Api::V1::Admin::ReportsController < Api::BaseController
|
||||||
|
|
||||||
def assign_to_self
|
def assign_to_self
|
||||||
authorize @report, :update?
|
authorize @report, :update?
|
||||||
@report.update!(assigned_account_id: current_account.id)
|
unless @report.assigned_account_id == current_account.id
|
||||||
log_action :assigned_to_self, @report
|
@report.update!(assigned_account_id: current_account.id)
|
||||||
|
log_action :assigned_to_self, @report
|
||||||
|
end
|
||||||
render json: @report, serializer: REST::Admin::ReportSerializer
|
render json: @report, serializer: REST::Admin::ReportSerializer
|
||||||
end
|
end
|
||||||
|
|
||||||
def unassign
|
def unassign
|
||||||
authorize @report, :update?
|
authorize @report, :update?
|
||||||
@report.update!(assigned_account_id: nil)
|
if @report.assigned_account_id
|
||||||
log_action :unassigned, @report
|
@report.update!(assigned_account_id: nil)
|
||||||
|
log_action :unassigned, @report
|
||||||
|
end
|
||||||
render json: @report, serializer: REST::Admin::ReportSerializer
|
render json: @report, serializer: REST::Admin::ReportSerializer
|
||||||
end
|
end
|
||||||
|
|
||||||
def reopen
|
def reopen
|
||||||
authorize @report, :update?
|
authorize @report, :update?
|
||||||
@report.unresolve!
|
unless @report.unresolved?
|
||||||
log_action :reopen, @report
|
@report.unresolve!
|
||||||
|
log_action :reopen, @report
|
||||||
|
end
|
||||||
render json: @report, serializer: REST::Admin::ReportSerializer
|
render json: @report, serializer: REST::Admin::ReportSerializer
|
||||||
end
|
end
|
||||||
|
|
||||||
def resolve
|
def resolve
|
||||||
authorize @report, :update?
|
authorize @report, :update?
|
||||||
@report.resolve!(current_account)
|
unless @report.action_taken?
|
||||||
log_action :resolve, @report
|
@report.resolve!(current_account)
|
||||||
|
log_action :resolve, @report
|
||||||
|
end
|
||||||
render json: @report, serializer: REST::Admin::ReportSerializer
|
render json: @report, serializer: REST::Admin::ReportSerializer
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue