docbrown/app/queries/users/select_moderators_query.rb
Ridhwana 686976ced8
Round Robin Notifications Refactor (#19026)
* chore: rubocop

* feat: rename the worker in accordance to our guidelines and to be more verbose

* refactor: move the NotificationsModeration service to be a users query, and move the constants out to new files

* refactor: removed subscribed_to_mod_roundrobin_notifications? which was only being used once in a test

* refactor: remove the aliass from the user method and add them to notification_setting + update references
2023-02-01 15:21:36 +02:00

14 lines
372 B
Ruby

module Users
class SelectModeratorsQuery
def self.call(...)
new(...).call
end
def call
User.with_role(:trusted).joins(:notification_setting)
.where(last_reacted_at: 1.week.ago..)
.where("last_moderation_notification < ?", 3.days.ago)
.where(notification_setting: { mod_roundrobin_notifications: true })
end
end
end