Sha256: eb6d91a28e4ae5ab3153f75ff0512d3238d070604309d643bedf1d4e4dae71c9

Contents?: true

Size: 1.34 KB

Versions: 15

Compression:

Stored size: 1.34 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
        include Decidim::ApplicationHelper

        helper Decidim::ResourceHelper
        helper Decidim::TranslationsHelper
        helper Decidim::ApplicationHelper

        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:)
          end
        end

        private

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

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
decidim-meetings-0.29.2 app/mailers/decidim/meetings/admin/invite_join_meeting_mailer.rb
decidim-meetings-0.28.5 app/mailers/decidim/meetings/admin/invite_join_meeting_mailer.rb
decidim-meetings-0.29.1 app/mailers/decidim/meetings/admin/invite_join_meeting_mailer.rb
decidim-meetings-0.28.4 app/mailers/decidim/meetings/admin/invite_join_meeting_mailer.rb
decidim-meetings-0.29.0 app/mailers/decidim/meetings/admin/invite_join_meeting_mailer.rb
decidim-meetings-0.28.3 app/mailers/decidim/meetings/admin/invite_join_meeting_mailer.rb
decidim-meetings-0.29.0.rc4 app/mailers/decidim/meetings/admin/invite_join_meeting_mailer.rb
decidim-meetings-0.29.0.rc3 app/mailers/decidim/meetings/admin/invite_join_meeting_mailer.rb
decidim-meetings-0.29.0.rc2 app/mailers/decidim/meetings/admin/invite_join_meeting_mailer.rb
decidim-meetings-0.29.0.rc1 app/mailers/decidim/meetings/admin/invite_join_meeting_mailer.rb
decidim-meetings-0.28.2 app/mailers/decidim/meetings/admin/invite_join_meeting_mailer.rb
decidim-meetings-0.28.1 app/mailers/decidim/meetings/admin/invite_join_meeting_mailer.rb
decidim-meetings-0.28.0 app/mailers/decidim/meetings/admin/invite_join_meeting_mailer.rb
decidim-meetings-0.28.0.rc5 app/mailers/decidim/meetings/admin/invite_join_meeting_mailer.rb
decidim-meetings-0.28.0.rc4 app/mailers/decidim/meetings/admin/invite_join_meeting_mailer.rb