File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -14,8 +14,9 @@ def unread_by(user)
1414 end
1515
1616 def remove_inaccessible_notifications
17- User . find_each do |user |
18- all_notifications_for ( user ) . destroy_all unless accessible_to? ( user )
17+ accessible_user_ids = board . accesses . pluck ( :user_id )
18+ [ event_notification_sources , mention_notification_sources ] . each do |sources |
19+ inaccessible_notifications_from ( sources , accessible_user_ids ) . in_batches . destroy_all
1920 end
2021 end
2122
@@ -44,6 +45,10 @@ def comment_creation_events
4445 Event . where ( eventable : comments )
4546 end
4647
48+ def inaccessible_notifications_from ( sources , accessible_user_ids )
49+ Notification . where ( source : sources ) . where . not ( user_id : accessible_user_ids )
50+ end
51+
4752 def mention_notification_sources
4853 mentions . or ( comment_mentions )
4954 end
You can’t perform that action at this time.
0 commit comments