Hotfix: set current tenant in invitations mailer (#400)

This commit is contained in:
Riccardo Graziosi
2024-09-07 11:36:21 +02:00
committed by GitHub
parent 519ec80b90
commit 53c7ffd95f
2 changed files with 12 additions and 3 deletions

View File

@@ -24,9 +24,15 @@ class InvitationsController < ApplicationController
invitation.save!
# replace %link% placeholder in body with the invitation link
body_with_link = body.gsub('%link%', get_url_for(method(:new_user_registration_url), options: { invitation_token: invitation_token, email: email }))
body_with_link = body.gsub(
'%link%',
get_url_for(
method(:new_user_registration_url),
options: { invitation_token: invitation_token, email: email }
)
)
InvitationMailer.invite(to: email, subject: subject, body: body_with_link).deliver_later
InvitationMailer.invite(invitation: invitation, subject: subject, body: body_with_link).deliver_later
num_invitations_sent += 1
end

View File

@@ -1,5 +1,8 @@
class InvitationMailer < ApplicationMailer
def invite(to:, subject:, body:)
def invite(invitation:, subject:, body:)
Current.tenant = invitation.tenant
to = invitation.email
@body = body
mail(