mirror of
https://github.com/mastodon/mastodon.git
synced 2026-06-10 17:51:19 -05:00
Some checks failed
Check i18n / check-i18n (push) Waiting to run
Chromatic / Check for relevant changes (push) Waiting to run
Chromatic / Run Chromatic (push) Blocked by required conditions
CodeQL / Analyze (actions) (push) Waiting to run
CodeQL / Analyze (javascript) (push) Waiting to run
CodeQL / Analyze (ruby) (push) Waiting to run
Check formatting / lint (push) Waiting to run
Ruby Testing / build (production) (push) Waiting to run
Ruby Testing / build (test) (push) Waiting to run
Ruby Testing / test (.ruby-version) (push) Blocked by required conditions
Ruby Testing / test (3.3) (push) Blocked by required conditions
Ruby Testing / test (3.4) (push) Blocked by required conditions
Ruby Testing / End to End testing (.ruby-version) (push) Blocked by required conditions
Ruby Testing / End to End testing (3.3) (push) Blocked by required conditions
Ruby Testing / End to End testing (3.4) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (.ruby-version, docker.elastic.co/elasticsearch/elasticsearch:7.17.29) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (.ruby-version, docker.elastic.co/elasticsearch/elasticsearch:8.19.2) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (.ruby-version, opensearchproject/opensearch:2) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (3.3, docker.elastic.co/elasticsearch/elasticsearch:7.17.29) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (3.4, docker.elastic.co/elasticsearch/elasticsearch:7.17.29) (push) Blocked by required conditions
Bundler Audit / security (push) Has been cancelled
Haml Linting / lint (push) Has been cancelled
Ruby Linting / lint (push) Has been cancelled
Historical data migration test / test (14-alpine) (push) Has been cancelled
Historical data migration test / test (15-alpine) (push) Has been cancelled
Historical data migration test / test (16-alpine) (push) Has been cancelled
Historical data migration test / test (17-alpine) (push) Has been cancelled
61 lines
1.6 KiB
Ruby
61 lines
1.6 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
module Admin
|
|
class ReportNotesController < BaseController
|
|
before_action :set_report_note, only: [:destroy]
|
|
|
|
def create
|
|
authorize :report_note, :create?
|
|
|
|
@report_note = current_account.report_notes.new(resource_params)
|
|
@report = @report_note.report
|
|
|
|
if @report_note.save
|
|
if params[:create_and_resolve]
|
|
@report.resolve!(current_account)
|
|
log_action :resolve, @report
|
|
elsif params[:create_and_unresolve]
|
|
@report.unresolve!
|
|
log_action :reopen, @report
|
|
end
|
|
|
|
redirect_to after_create_redirect_path, notice: I18n.t('admin.report_notes.created_msg')
|
|
else
|
|
@report_notes = @report.notes.chronological.includes(:account)
|
|
@action_logs = @report.history.includes(:target)
|
|
@form = Admin::StatusBatchAction.new
|
|
@statuses = @report.statuses.with_includes
|
|
@collections = @report.collections
|
|
@collection_form = Admin::CollectionBatchAction.new
|
|
|
|
render 'admin/reports/show'
|
|
end
|
|
end
|
|
|
|
def destroy
|
|
authorize @report_note, :destroy?
|
|
@report_note.destroy!
|
|
redirect_to admin_report_path(@report_note.report_id), notice: I18n.t('admin.report_notes.destroyed_msg')
|
|
end
|
|
|
|
private
|
|
|
|
def after_create_redirect_path
|
|
if params[:create_and_resolve]
|
|
admin_reports_path
|
|
else
|
|
admin_report_path(@report)
|
|
end
|
|
end
|
|
|
|
def resource_params
|
|
params
|
|
.expect(report_note: [:content, :report_id])
|
|
end
|
|
|
|
def set_report_note
|
|
@report_note = ReportNote.find(params[:id])
|
|
end
|
|
end
|
|
end
|