Sha256: 80c22362fd811c4e15a7dca2a3986ad19799c5e07ce2dfda6157622b81797c19

Contents?: true

Size: 1.27 KB

Versions: 5

Compression:

Stored size: 1.27 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 ActionView::Helpers::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
          @router ||= Decidim::EngineRouter.main_proxy(@meeting.feature)
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
decidim-meetings-0.7.4 app/mailers/decidim/meetings/admin/invite_join_meeting_mailer.rb
decidim-meetings-0.7.3 app/mailers/decidim/meetings/admin/invite_join_meeting_mailer.rb
decidim-meetings-0.7.2 app/mailers/decidim/meetings/admin/invite_join_meeting_mailer.rb
decidim-meetings-0.7.1 app/mailers/decidim/meetings/admin/invite_join_meeting_mailer.rb
decidim-meetings-0.7.0 app/mailers/decidim/meetings/admin/invite_join_meeting_mailer.rb