Prevent error when no one is subscribed

This commit is contained in:
Karina Kwiatek 2023-03-05 14:15:52 +01:00
parent b93058b11d
commit 9c4b2e452a
1 changed files with 1 additions and 1 deletions

View File

@ -32,7 +32,7 @@ class Subscription < ApplicationRecord
{ target_id: source.id, target_type: Comment, recipient_id: s.user_id, new: true, type: Notification::Commented }
end
Notification.insert_all!(notifications) # rubocop:disable Rails/SkipsModelValidations
Notification.insert_all!(notifications) unless notifications.empty? # rubocop:disable Rails/SkipsModelValidations
end
def denotify(source, target)