Sha256: e243a4245be799e3226c75b0256512ebfc0c5d0a381590cc92195419520d96fb

Contents?: true

Size: 688 Bytes

Versions: 58

Compression:

Stored size: 688 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

      def resource_text
        resource.body
      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

58 entries across 58 versions & 1 rubygems

Version Path
decidim-proposals-0.27.9 app/events/decidim/proposals/proposal_endorsed_event.rb
decidim-proposals-0.27.8 app/events/decidim/proposals/proposal_endorsed_event.rb
decidim-proposals-0.27.7 app/events/decidim/proposals/proposal_endorsed_event.rb
decidim-proposals-0.27.6 app/events/decidim/proposals/proposal_endorsed_event.rb
decidim-proposals-0.26.10 app/events/decidim/proposals/proposal_endorsed_event.rb
decidim-proposals-0.26.9 app/events/decidim/proposals/proposal_endorsed_event.rb
decidim-proposals-0.27.5 app/events/decidim/proposals/proposal_endorsed_event.rb
decidim-proposals-0.26.8 app/events/decidim/proposals/proposal_endorsed_event.rb
decidim-proposals-0.27.4 app/events/decidim/proposals/proposal_endorsed_event.rb
decidim-proposals-0.27.3 app/events/decidim/proposals/proposal_endorsed_event.rb
decidim-proposals-0.26.7 app/events/decidim/proposals/proposal_endorsed_event.rb
decidim-proposals-0.26.5 app/events/decidim/proposals/proposal_endorsed_event.rb
decidim-proposals-0.27.2 app/events/decidim/proposals/proposal_endorsed_event.rb
decidim-proposals-0.27.1 app/events/decidim/proposals/proposal_endorsed_event.rb
decidim-proposals-0.26.4 app/events/decidim/proposals/proposal_endorsed_event.rb
decidim-proposals-0.27.0 app/events/decidim/proposals/proposal_endorsed_event.rb
decidim-proposals-0.26.3 app/events/decidim/proposals/proposal_endorsed_event.rb
decidim-proposals-0.27.0.rc2 app/events/decidim/proposals/proposal_endorsed_event.rb
decidim-proposals-0.27.0.rc1 app/events/decidim/proposals/proposal_endorsed_event.rb
decidim-proposals-0.26.2 app/events/decidim/proposals/proposal_endorsed_event.rb