Use null-safe navigation for `denotify`

This commit is contained in:
Karina Kwiatek 2022-07-17 21:03:23 +02:00 committed by Karina Kwiatek
parent a5bb4c01b5
commit 4f88b82361
2 changed files with 2 additions and 2 deletions

View File

@ -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

View File

@ -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