Skip to content

Commit

Permalink
Extension notifications - don't send email if to address blank
Browse files Browse the repository at this point in the history
  • Loading branch information
mbiang committed Apr 29, 2019
1 parent 34849c1 commit f3d6725
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions app/mailers/extension_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def follower_notification_email(extension_version, user)
@email_preference = user.email_preference_for('New extension version')
@to = user.email

mail(to: @to, subject: "A new version of the #{@extension_version.name} #{I18n.t('nouns.extension')} has been released")
mail(to: @to, subject: "A new version of the #{@extension_version.name} #{I18n.t('nouns.extension')} has been released") unless @to.blank?
end

#
Expand All @@ -29,7 +29,7 @@ def extension_deleted_email(name, user)
@email_preference = user.email_preference_for('Extension deleted')
@to = user.email

mail(to: @to, subject: "The #{name} #{I18n.t('nouns.extension')} has been deleted")
mail(to: @to, subject: "The #{name} #{I18n.t('nouns.extension')} has been deleted") unless @to.blank?
end

#
Expand All @@ -52,7 +52,7 @@ def extension_deprecated_email(extension, replacement_extension, user)
of the #{@replacement_extension.name} #{I18n.t('nouns.extension')}
).squish

mail(to: @to, subject: subject)
mail(to: @to, subject: subject) unless @to.blank?
end

#
Expand Down Expand Up @@ -89,7 +89,7 @@ def notify_moderator_of_new(extension_id, user_id)

@subject = %(New #{I18n.t('nouns.extension')} "#{@extension.name}" has been added to the Bonsai Asset Index)

mail(to: @moderator.email, subject: @subject)
mail(to: @moderator.email, subject: @subject) unless @moderator.email.blank?
end

#
Expand All @@ -107,6 +107,6 @@ def notify_moderator_of_reported(extension_id, user_id, report_description, repo

@subject = %(#{I18n.t('nouns.extension').capitalize} "#{@extension.name}" reported)

mail(to: @moderator.email, subject: @subject)
mail(to: @moderator.email, subject: @subject) unless @moderator.email.blank?
end
end

0 comments on commit f3d6725

Please sign in to comment.