You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
618 B
27 lines
618 B
# 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')
|
|
rescue ActiveRecord::RecordInvalid => e
|
|
@appeal = e.record
|
|
render template: 'disputes/strikes/show'
|
|
end
|
|
|
|
private
|
|
|
|
def set_strike
|
|
@strike = current_account.strikes.find(params[:strike_id])
|
|
end
|
|
|
|
def appeal_params
|
|
params.require(:appeal).permit(:text)
|
|
end
|
|
end
|