Sha256: 15faf1a2089a6319ce30bba2ef9a41de9095a868df06ed5d4dc939e772e941ef

Contents?: true

Size: 631 Bytes

Versions: 19

Compression:

Stored size: 631 Bytes

Contents

# frozen-string_literal: true

module Decidim
  module Proposals
    class ProposalEndorsedEvent < Decidim::Events::SimpleEvent
      i18n_attributes :endorser_nickname, :endorser_name, :endorser_path, :nickname

      delegate :nickname, :name, to: :endorser, prefix: true

      def nickname
        endorser_nickname
      end

      def endorser_path
        endorser.profile_path
      end

      private

      def endorser
        @endorser ||= Decidim::UserPresenter.new(endorser_user)
      end

      def endorser_user
        @endorser_user ||= Decidim::User.find_by(id: extra[:endorser_id])
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
decidim-proposals-0.15.2 app/events/decidim/proposals/proposal_endorsed_event.rb
decidim-proposals-0.15.1 app/events/decidim/proposals/proposal_endorsed_event.rb
decidim-proposals-0.15.0 app/events/decidim/proposals/proposal_endorsed_event.rb
decidim-proposals-0.14.4 app/events/decidim/proposals/proposal_endorsed_event.rb
decidim-proposals-0.14.3 app/events/decidim/proposals/proposal_endorsed_event.rb
decidim-proposals-0.14.2 app/events/decidim/proposals/proposal_endorsed_event.rb
decidim-proposals-0.14.1 app/events/decidim/proposals/proposal_endorsed_event.rb
decidim-proposals-0.13.1 app/events/decidim/proposals/proposal_endorsed_event.rb
decidim-proposals-0.12.2 app/events/decidim/proposals/proposal_endorsed_event.rb
decidim-proposals-0.13.0 app/events/decidim/proposals/proposal_endorsed_event.rb
decidim-proposals-0.12.1 app/events/decidim/proposals/proposal_endorsed_event.rb
decidim-proposals-0.13.0.pre1 app/events/decidim/proposals/proposal_endorsed_event.rb
decidim-proposals-0.12.0 app/events/decidim/proposals/proposal_endorsed_event.rb
decidim-proposals-0.11.2 app/events/decidim/proposals/proposal_endorsed_event.rb
decidim-proposals-0.12.0.pre app/events/decidim/proposals/proposal_endorsed_event.rb
decidim-proposals-0.11.1 app/events/decidim/proposals/proposal_endorsed_event.rb
decidim-proposals-0.11.0.pre1 app/events/decidim/proposals/proposal_endorsed_event.rb
decidim-proposals-0.10.1 app/events/decidim/proposals/proposal_endorsed_event.rb
decidim-proposals-0.10.0 app/events/decidim/proposals/proposal_endorsed_event.rb