diff --git a/app/models/reaction.rb b/app/models/reaction.rb index 142a79fd1..cbba6b6eb 100644 --- a/app/models/reaction.rb +++ b/app/models/reaction.rb @@ -65,10 +65,8 @@ class Reaction < ApplicationRecord # - reaction is negative # - receiver is the same user as the one who reacted # - receive_notification is disabled - def skip_notification_for?(receiver) - points.negative? || - (user_id == reactable.user_id) || - (receiver.is_a?(User) && reactable.receive_notifications == false) + def skip_notification_for?(_receiver) + points.negative? || (user_id == reactable.user_id) end def vomit_on_user? diff --git a/spec/models/notification_spec.rb b/spec/models/notification_spec.rb index bc09e40ed..8cac58f5e 100644 --- a/spec/models/notification_spec.rb +++ b/spec/models/notification_spec.rb @@ -344,13 +344,13 @@ RSpec.describe Notification, type: :model do end.to change(user.notifications, :count).by(0) end - it "does not send a notification to the author of an article" do + it "does send a notification to the author of an article" do article.update(receive_notifications: false) reaction = create(:reaction, reactable: article, user: user2) expect do described_class.send_reaction_notification_without_delay(reaction, reaction.reactable.user) - end.to change(user.notifications, :count).by(0) + end.to change(user.notifications, :count).by(1) end end diff --git a/spec/models/reaction_spec.rb b/spec/models/reaction_spec.rb index 3cdca3529..96216f1fe 100644 --- a/spec/models/reaction_spec.rb +++ b/spec/models/reaction_spec.rb @@ -124,11 +124,6 @@ RSpec.describe Reaction, type: :model do reaction.reactable.user_id = user_id expect(reaction.skip_notification_for?(user)).to be(true) end - - it "is true when the receive_notifications is false" do - reaction.reactable.receive_notifications = false - expect(reaction.skip_notification_for?(receiver)).to be(true) - end end end