Sha256: e8c68d5aaa56598257452257f0c81bcf6825a8346522c0d2172791feb677c9fc

Contents?: true

Size: 634 Bytes

Versions: 8

Compression:

Stored size: 634 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module ActionDelegator
    class VoteDelegation
      def initialize(response, context)
        @response = response
        @context = context
      end

      def call
        PaperTrail.request.controller_info = { decidim_action_delegator_delegation_id: context.delegation.id }
        WhodunnitVote.new(build_vote, context.current_user)
      end

      private

      attr_reader :context, :response

      def build_vote
        context.current_question.votes.build(
          author: context.delegation.granter,
          response: response
        )
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
decidim-action_delegator-0.8.1 app/commands/decidim/action_delegator/vote_delegation.rb
decidim-action_delegator-0.7.2 app/commands/decidim/action_delegator/vote_delegation.rb
decidim-action_delegator-0.7.1 app/commands/decidim/action_delegator/vote_delegation.rb
decidim-action_delegator-0.7.0 app/commands/decidim/action_delegator/vote_delegation.rb
decidim-action_delegator-0.6.0 app/commands/decidim/action_delegator/vote_delegation.rb
decidim-action_delegator-0.5.0 app/commands/decidim/action_delegator/vote_delegation.rb
decidim-action_delegator-0.4.1 app/commands/decidim/action_delegator/vote_delegation.rb
decidim-action_delegator-0.4 app/commands/decidim/action_delegator/vote_delegation.rb