Skip to content

Commit

Permalink
Use enabled scope for the subscribers when sending notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
aapomm committed Dec 20, 2024
1 parent aabe69c commit 3183427
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/comment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def notify(action:, actor:, recipients:)
# to be an ActiveRecord::Relation.
subscribers = User.includes(:subscriptions).where(
subscriptions: { subscribable_id: commentable.id, subscribable_type: commentable.class.to_s }
).where.not(id: [user.id] + mentions.pluck(:id))
).where.not(id: [user.id] + mentions.pluck(:id)).enabled
subscribers = subscribers.select { |user| Ability.new(user).can?(:read, self) }
create_notifications(action: :create, actor: actor, recipients: subscribers)
end
Expand Down

0 comments on commit 3183427

Please sign in to comment.