app/controllers/decidim/consultations/question_votes_controller.rb in decidim-consultations-0.11.2 vs app/controllers/decidim/consultations/question_votes_controller.rb in decidim-consultations-0.12.0.pre

- old
+ new

@@ -1,17 +1,17 @@ # frozen_string_literal: true module Decidim module Consultations - class QuestionVotesController < Decidim::ApplicationController + class QuestionVotesController < Decidim::Consultations::ApplicationController include NeedsQuestion include Decidim::FormFactory before_action :authenticate_user! def create - authorize! :vote, current_question + enforce_permission_to :vote, :question, question: current_question vote_form = form(VoteForm).from_params(params, current_question: current_question) VoteQuestion.call(vote_form) do on(:ok) do current_question.reload @@ -25,10 +25,10 @@ end end end def destroy - authorize! :unvote, current_question + enforce_permission_to :unvote, :question, question: current_question UnvoteQuestion.call(current_question, current_user) do on(:ok) do current_question.reload render :update_vote_button end