Sha256: 4fe052e4b43ba29fed8d9d01a5208636bcafa6a266fbd1c2fb841b02ee9c69ae

Contents?: true

Size: 1.26 KB

Versions: 2

Compression:

Stored size: 1.26 KB

Contents

# frozen_string_literal: true

module Decidim
  module Meetings
    module Admin
      # A custom mailer for sending an invitation to join a meeting to
      # an existing user.
      class InviteJoinMeetingMailer < Decidim::ApplicationMailer
        include Decidim::TranslationsHelper
        include Decidim::SanitizeHelper

        helper Decidim::ResourceHelper
        helper Decidim::TranslationsHelper

        helper_method :routes

        # Send an email to an user to invite them to join a meeting.
        #
        # user - The user being invited
        # meeting - The meeting being joined.
        # invited_by - The user performing the invitation.
        def invite(user, meeting, invited_by)
          with_user(user) do
            @user = user
            @meeting = meeting
            @invited_by = invited_by
            @organization = @meeting.organization
            @locator = Decidim::ResourceLocatorPresenter.new(@meeting)

            subject = I18n.t("invite.subject", scope: "decidim.meetings.mailer.invite_join_meeting_mailer")
            mail(to: user.email, subject: subject)
          end
        end

        private

        def routes
          @routes ||= Decidim::EngineRouter.main_proxy(@meeting.feature)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
decidim-meetings-0.10.1 app/mailers/decidim/meetings/admin/invite_join_meeting_mailer.rb
decidim-meetings-0.10.0 app/mailers/decidim/meetings/admin/invite_join_meeting_mailer.rb