Use rescue_from to handle missing status scenario in NotificationMailer (#38155)
This commit is contained in:
parent
9215e1ec53
commit
03b20bc0a4
@ -19,17 +19,15 @@ class NotificationMailer < ApplicationMailer
|
||||
|
||||
default to: -> { email_address_with_name(@user.email, @me.username) }
|
||||
|
||||
rescue_from(ActiveRecord::RecordNotFound) { false }
|
||||
|
||||
layout 'mailer'
|
||||
|
||||
def mention
|
||||
return if @status.blank?
|
||||
|
||||
mail subject: default_i18n_subject(name: @status.account.acct)
|
||||
end
|
||||
|
||||
def quote
|
||||
return if @status.blank?
|
||||
|
||||
mail subject: default_i18n_subject(name: @status.account.acct)
|
||||
end
|
||||
|
||||
@ -38,14 +36,10 @@ class NotificationMailer < ApplicationMailer
|
||||
end
|
||||
|
||||
def favourite
|
||||
return if @status.blank?
|
||||
|
||||
mail subject: default_i18n_subject(name: @account.acct)
|
||||
end
|
||||
|
||||
def reblog
|
||||
return if @status.blank?
|
||||
|
||||
mail subject: default_i18n_subject(name: @account.acct)
|
||||
end
|
||||
|
||||
@ -64,7 +58,7 @@ class NotificationMailer < ApplicationMailer
|
||||
end
|
||||
|
||||
def set_status
|
||||
@status = @notification.target_status
|
||||
@status = @notification.target_status || raise(ActiveRecord::RecordNotFound)
|
||||
end
|
||||
|
||||
def set_account
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user