Sha256: a9b0c72ff1634d421b1a7b3e95bb6c8f38cc7d08e42fcffcd1867ed213e4aff5
Contents?: true
Size: 1005 Bytes
Versions: 37
Compression:
Stored size: 1005 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: 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
37 entries across 37 versions & 1 rubygems