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.

26 lines
618 B

  1. # frozen_string_literal: true
  2. class Disputes::AppealsController < Disputes::BaseController
  3. before_action :set_strike
  4. def create
  5. authorize @strike, :appeal?
  6. @appeal = AppealService.new.call(@strike, appeal_params[:text])
  7. redirect_to disputes_strike_path(@strike), notice: I18n.t('disputes.strikes.appealed_msg')
  8. rescue ActiveRecord::RecordInvalid => e
  9. @appeal = e.record
  10. render template: 'disputes/strikes/show'
  11. end
  12. private
  13. def set_strike
  14. @strike = current_account.strikes.find(params[:strike_id])
  15. end
  16. def appeal_params
  17. params.require(:appeal).permit(:text)
  18. end
  19. end