Sha256: af94b9dc65006ae237704b7027cd85baa8cb0d268b608f0e60aeefdbcb7600e2
Contents?: true
Size: 998 Bytes
Versions: 18
Compression:
Stored size: 998 Bytes
Contents
# frozen_string_literal: true module Decidim module Comments # Controller that manages the comment votes. # class VotesController < Decidim::Comments::ApplicationController before_action :authenticate_user! before_action :set_comment helper_method :comment def create raise ActionController::RoutingError, "Not Found" unless comment enforce_permission_to(:vote, :comment, comment:) Decidim::Comments::VoteComment.call(comment, current_user, weight: params[:weight].to_i) do on(:ok) do respond_to do |format| format.js { render :create } end end on(:invalid) do respond_to do |format| format.js { render :error } end end end end private attr_reader :comment def set_comment @comment = Decidim::Comments::Comment.find_by(id: params[:comment_id]) end end end end
Version data entries
18 entries across 18 versions & 1 rubygems