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
|
comment.user&.decrement! :commented_count
|
||||||
Subscription.denotify comment, self
|
Subscription.denotify comment, self
|
||||||
end
|
end
|
||||||
Notification.denotify self.question.user, self
|
Notification.denotify question&.user, self
|
||||||
Subscription.destruct self
|
Subscription.destruct self
|
||||||
end
|
end
|
||||||
# rubocop:enable Rails/SkipsModelValidations
|
# rubocop:enable Rails/SkipsModelValidations
|
||||||
|
|
|
@ -9,7 +9,7 @@ class Appendable::Reaction < Appendable
|
||||||
end
|
end
|
||||||
|
|
||||||
before_destroy do
|
before_destroy do
|
||||||
Notification.denotify parent.user, self
|
Notification.denotify parent&.user, self
|
||||||
user&.decrement! :smiled_count
|
user&.decrement! :smiled_count
|
||||||
parent&.decrement! :smile_count
|
parent&.decrement! :smile_count
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue