]> cat aescling's git repositories - mastodon.git/blob - app/controllers/admin/reported_statuses_controller.rb
Display trending hashtags on admin dashboard (#8038)
[mastodon.git] / app / controllers / admin / reported_statuses_controller.rb
1 # frozen_string_literal: true
2
3 module Admin
4 class ReportedStatusesController < BaseController
5 before_action :set_report
6
7 def create
8 authorize :status, :update?
9
10 @form = Form::StatusBatch.new(form_status_batch_params.merge(current_account: current_account, action: action_from_button))
11 flash[:alert] = I18n.t('admin.statuses.failed_to_execute') unless @form.save
12
13 redirect_to admin_report_path(@report)
14 end
15
16 private
17
18 def status_params
19 params.require(:status).permit(:sensitive)
20 end
21
22 def form_status_batch_params
23 params.require(:form_status_batch).permit(status_ids: [])
24 end
25
26 def action_from_button
27 if params[:nsfw_on]
28 'nsfw_on'
29 elsif params[:nsfw_off]
30 'nsfw_off'
31 elsif params[:delete]
32 'delete'
33 end
34 end
35
36 def set_report
37 @report = Report.find(params[:report_id])
38 end
39 end
40 end
This page took 0.079811 seconds and 4 git commands to generate.