Sha256: fdb8387e27ba8a6c49e14d3c42e31253d64bc3a621427525c9847267a899ba2a

Contents?: true

Size: 1.37 KB

Versions: 3

Compression:

Stored size: 1.37 KB

Contents

# frozen_string_literal: true

module Decidim
  module Initiatives
    class ApproveMembershipRequestEvent < Decidim::Events::BaseEvent
      include Decidim::Events::EmailEvent
      include Decidim::Events::NotificationEvent

      def email_subject
        I18n.t(
          "decidim.initiatives.events.approve_membership_request.email_subject",
          author_nickname:
        )
      end

      def email_intro
        I18n.t(
          "decidim.initiatives.events.approve_membership_request.email_intro",
          resource_title:,
          resource_url:,
          author_profile_url:,
          author_nickname:
        )
      end

      def email_outro
        I18n.t(
          "decidim.initiatives.events.approve_membership_request.email_outro",
          resource_title:,
          resource_url:
        )
      end

      def notification_title
        I18n.t(
          "decidim.initiatives.events.approve_membership_request.notification_title",
          resource_title:,
          resource_url:,
          author_profile_url:,
          author_nickname:
        ).html_safe
      end

      private

      def author_nickname
        author.nickname
      end

      def author_profile_url
        author.profile_url
      end

      def author
        @author ||= Decidim::UserPresenter.new(
          Decidim::User.find(@extra["author"]["id"])
        )
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
decidim-initiatives-0.28.0 app/events/decidim/initiatives/approve_membership_request_event.rb
decidim-initiatives-0.28.0.rc5 app/events/decidim/initiatives/approve_membership_request_event.rb
decidim-initiatives-0.28.0.rc4 app/events/decidim/initiatives/approve_membership_request_event.rb