mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-24 16:18:42 -05:00
21 lines
538 B
Ruby
21 lines
538 B
Ruby
require_dependency 'flag_query'
|
|
|
|
module Jobs
|
|
|
|
class PendingFlagsReminder < Jobs::Scheduled
|
|
|
|
every 1.day
|
|
|
|
def execute(args)
|
|
if SiteSetting.notify_about_flags_after > 0 &&
|
|
PostAction.flagged_posts_count > 0 &&
|
|
FlagQuery.flagged_post_actions('active').where('post_actions.created_at < ?', SiteSetting.notify_about_flags_after.to_i.hours.ago).pluck(:id).count > 0
|
|
|
|
message = PendingFlagsMailer.notify
|
|
Email::Sender.new(message, :pending_flags_reminder).send
|
|
end
|
|
end
|
|
|
|
end
|
|
|
|
end
|