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) }
|
default to: -> { email_address_with_name(@user.email, @me.username) }
|
||||||
|
|
||||||
|
rescue_from(ActiveRecord::RecordNotFound) { false }
|
||||||
|
|
||||||
layout 'mailer'
|
layout 'mailer'
|
||||||
|
|
||||||
def mention
|
def mention
|
||||||
return if @status.blank?
|
|
||||||
|
|
||||||
mail subject: default_i18n_subject(name: @status.account.acct)
|
mail subject: default_i18n_subject(name: @status.account.acct)
|
||||||
end
|
end
|
||||||
|
|
||||||
def quote
|
def quote
|
||||||
return if @status.blank?
|
|
||||||
|
|
||||||
mail subject: default_i18n_subject(name: @status.account.acct)
|
mail subject: default_i18n_subject(name: @status.account.acct)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -38,14 +36,10 @@ class NotificationMailer < ApplicationMailer
|
|||||||
end
|
end
|
||||||
|
|
||||||
def favourite
|
def favourite
|
||||||
return if @status.blank?
|
|
||||||
|
|
||||||
mail subject: default_i18n_subject(name: @account.acct)
|
mail subject: default_i18n_subject(name: @account.acct)
|
||||||
end
|
end
|
||||||
|
|
||||||
def reblog
|
def reblog
|
||||||
return if @status.blank?
|
|
||||||
|
|
||||||
mail subject: default_i18n_subject(name: @account.acct)
|
mail subject: default_i18n_subject(name: @account.acct)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -64,7 +58,7 @@ class NotificationMailer < ApplicationMailer
|
|||||||
end
|
end
|
||||||
|
|
||||||
def set_status
|
def set_status
|
||||||
@status = @notification.target_status
|
@status = @notification.target_status || raise(ActiveRecord::RecordNotFound)
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_account
|
def set_account
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user