FIX: Correctly use invite to topic email templates (#12411)

It was used both when inviting from a topic page and when creating
invites with "Send to topic on first login", while it should be used
only in the former case.
This commit is contained in:
Dan Ungureanu
2021-03-16 17:08:54 +02:00
committed by GitHub
parent bc88ea5976
commit fb19ee9eee
7 changed files with 10 additions and 7 deletions

View File

@ -5,7 +5,7 @@ class InviteMailer < ActionMailer::Base
layout 'email_template'
def send_invite(invite)
def send_invite(invite, invite_to_topic: false)
# Find the first topic they were invited to
first_topic = invite.topics.order(:created_at).first
@ -19,7 +19,7 @@ class InviteMailer < ActionMailer::Base
ActionView::Base.full_sanitizer.sanitize(invite.custom_message.gsub(/\n+/, " ").strip) : nil
# If they were invited to a topic
if first_topic.present?
if invite_to_topic && first_topic.present?
# get topic excerpt
topic_excerpt = ""
if first_topic.excerpt