2022-02-14 20:27:53 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class Disputes::AppealsController < Disputes::BaseController
|
|
|
|
before_action :set_strike
|
|
|
|
|
|
|
|
def create
|
|
|
|
authorize @strike, :appeal?
|
|
|
|
|
|
|
|
@appeal = AppealService.new.call(@strike, appeal_params[:text])
|
|
|
|
|
|
|
|
redirect_to disputes_strike_path(@strike), notice: I18n.t('disputes.strikes.appealed_msg')
|
2022-02-16 21:29:48 +00:00
|
|
|
rescue ActiveRecord::RecordInvalid => e
|
|
|
|
@appeal = e.record
|
2023-11-29 10:38:05 +00:00
|
|
|
render 'disputes/strikes/show'
|
2022-02-14 20:27:53 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def set_strike
|
|
|
|
@strike = current_account.strikes.find(params[:strike_id])
|
|
|
|
end
|
|
|
|
|
|
|
|
def appeal_params
|
|
|
|
params.require(:appeal).permit(:text)
|
|
|
|
end
|
|
|
|
end
|