Sha256: 90c8cbfca88033d2ce7bf9a78babcf5fe9470d255002e181dfb57656cb51e0f6

Contents?: true

Size: 1.54 KB

Versions: 33

Compression:

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

33 entries across 33 versions & 1 rubygems

Version Path
decidim-initiatives-0.25.2 app/events/decidim/initiatives/approve_membership_request_event.rb
decidim-initiatives-0.25.1 app/events/decidim/initiatives/approve_membership_request_event.rb
decidim-initiatives-0.25.0 app/events/decidim/initiatives/approve_membership_request_event.rb
decidim-initiatives-0.25.0.rc4 app/events/decidim/initiatives/approve_membership_request_event.rb
decidim-initiatives-0.25.0.rc3 app/events/decidim/initiatives/approve_membership_request_event.rb
decidim-initiatives-0.25.0.rc2 app/events/decidim/initiatives/approve_membership_request_event.rb
decidim-initiatives-0.25.0.rc1 app/events/decidim/initiatives/approve_membership_request_event.rb
decidim-initiatives-0.24.3 app/events/decidim/initiatives/approve_membership_request_event.rb
decidim-initiatives-0.24.2 app/events/decidim/initiatives/approve_membership_request_event.rb
decidim-initiatives-0.24.1 app/events/decidim/initiatives/approve_membership_request_event.rb
decidim-initiatives-0.24.0 app/events/decidim/initiatives/approve_membership_request_event.rb
decidim-initiatives-0.24.0.rc2 app/events/decidim/initiatives/approve_membership_request_event.rb
decidim-initiatives-0.24.0.rc1 app/events/decidim/initiatives/approve_membership_request_event.rb