mirror of
https://github.com/Retrospring/retrospring.git
synced 2025-01-18 20:36:01 +01:00
Use null-safe navigation for denotify
This commit is contained in:
parent
a5bb4c01b5
commit
4f88b82361
2 changed files with 2 additions and 2 deletions
|
@ -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 a new issue