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.26.10 app/events/decidim/initiatives/approve_membership_request_event.rb
decidim-initiatives-0.26.9 app/events/decidim/initiatives/approve_membership_request_event.rb
decidim-initiatives-0.27.5 app/events/decidim/initiatives/approve_membership_request_event.rb
decidim-initiatives-0.26.8 app/events/decidim/initiatives/approve_membership_request_event.rb
decidim-initiatives-0.27.4 app/events/decidim/initiatives/approve_membership_request_event.rb
decidim-initiatives-0.27.3 app/events/decidim/initiatives/approve_membership_request_event.rb
decidim-initiatives-0.26.7 app/events/decidim/initiatives/approve_membership_request_event.rb
decidim-initiatives-0.26.5 app/events/decidim/initiatives/approve_membership_request_event.rb
decidim-initiatives-0.27.2 app/events/decidim/initiatives/approve_membership_request_event.rb
decidim-initiatives-0.27.1 app/events/decidim/initiatives/approve_membership_request_event.rb
decidim-initiatives-0.26.4 app/events/decidim/initiatives/approve_membership_request_event.rb
decidim-initiatives-0.27.0 app/events/decidim/initiatives/approve_membership_request_event.rb
decidim-initiatives-0.26.3 app/events/decidim/initiatives/approve_membership_request_event.rb
decidim-initiatives-0.27.0.rc2 app/events/decidim/initiatives/approve_membership_request_event.rb
decidim-initiatives-0.27.0.rc1 app/events/decidim/initiatives/approve_membership_request_event.rb
decidim-initiatives-0.26.2 app/events/decidim/initiatives/approve_membership_request_event.rb
decidim-initiatives-0.26.1 app/events/decidim/initiatives/approve_membership_request_event.rb
decidim-initiatives-0.26.0 app/events/decidim/initiatives/approve_membership_request_event.rb
decidim-initiatives-0.26.0.rc2 app/events/decidim/initiatives/approve_membership_request_event.rb
decidim-initiatives-0.26.0.rc1 app/events/decidim/initiatives/approve_membership_request_event.rb