Use null-safe navigation for `denotify`
This commit is contained in:
parent
a5bb4c01b5
commit
4f88b82361
|
@ -38,7 +38,7 @@ class Answer < ApplicationRecord
|
|||
comment.user&.decrement! :commented_count
|
||||
Subscription.denotify comment, self
|
||||
end
|
||||
Notification.denotify self.question.user, self
|
||||
Notification.denotify question&.user, self
|
||||
Subscription.destruct self
|
||||
end
|
||||
# rubocop:enable Rails/SkipsModelValidations
|
||||
|
|
|
@ -9,7 +9,7 @@ class Appendable::Reaction < Appendable
|
|||
end
|
||||
|
||||
before_destroy do
|
||||
Notification.denotify parent.user, self
|
||||
Notification.denotify parent&.user, self
|
||||
user&.decrement! :smiled_count
|
||||
parent&.decrement! :smile_count
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue