diff --git a/app/models/notification.rb b/app/models/notification.rb index 503da6370..fa28192e5 100644 --- a/app/models/notification.rb +++ b/app/models/notification.rb @@ -43,18 +43,11 @@ class Notification < ApplicationRecord Notifications::NotifiableActionJob.perform_later(notifiable.id, notifiable.class.name, action) end - def send_new_comment_notifications(comment) - return if comment.commentable_type == "PodcastEpisode" - return if UserBlock.blocking?(comment.commentable.user_id, comment.user_id) - - Notifications::NewCommentJob.perform_later(comment.id) - end - def send_new_comment_notifications_without_delay(comment) return if comment.commentable_type == "PodcastEpisode" return if UserBlock.blocking?(comment.commentable.user_id, comment.user_id) - Notifications::NewCommentJob.perform_now(comment.id) + Notifications::NewComment::Send.call(comment) end def send_new_badge_achievement_notification(badge_achievement) diff --git a/spec/models/notification_spec.rb b/spec/models/notification_spec.rb index 4c37813f8..87b8cb7a3 100644 --- a/spec/models/notification_spec.rb +++ b/spec/models/notification_spec.rb @@ -187,7 +187,7 @@ RSpec.describe Notification, type: :model do end end - describe "#send_new_comment_notifications" do + describe "#send_new_comment_notifications_without_delay" do let_it_be_changeable(:comment) { create(:comment, user: user2, commentable: article) } let_it_be_readonly(:child_comment) { create(:comment, user: user3, commentable: article, parent: comment) } diff --git a/spec/requests/comments_update_spec.rb b/spec/requests/comments_update_spec.rb index fe7b4b8e3..99cdf3c33 100644 --- a/spec/requests/comments_update_spec.rb +++ b/spec/requests/comments_update_spec.rb @@ -7,7 +7,7 @@ RSpec.describe "CommentsUpdate", type: :request do before do sign_in user - Notification.send_new_comment_notifications(comment) + Notification.send_new_comment_notifications_without_delay(comment) end it "updates ordinary article with proper params" do