Sha256: 966510c7be9db3f765f3c2b990a530959d0b95050a7b331d0ff0d28f1561b16d

Contents?: true

Size: 1.45 KB

Versions: 4

Compression:

Stored size: 1.45 KB

Contents

# frozen-string_literal: true

module Decidim
  module Initiatives
    class ApproveMembershipRequestEvent < Decidim::Events::SimpleEvent
      def email_subject
        I18n.t(
          "decidim.initiatives.events.approve_membership_request.email_subject",
          author_nickname: author_nickname
        )
      end

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

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

      def notification_title
        I18n.t(
          "decidim.initiatives.events.approve_membership_request.notification_title",
          resource_title: resource_title,
          resource_url: resource_url,
          author_profile_url: author_profile_url,
          author_nickname: 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

4 entries across 4 versions & 1 rubygems

Version Path
decidim-initiatives-0.27.9 app/events/decidim/initiatives/approve_membership_request_event.rb
decidim-initiatives-0.27.8 app/events/decidim/initiatives/approve_membership_request_event.rb
decidim-initiatives-0.27.7 app/events/decidim/initiatives/approve_membership_request_event.rb
decidim-initiatives-0.27.6 app/events/decidim/initiatives/approve_membership_request_event.rb