mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-12-21 04:52:54 -05:00
22 lines
499 B
Ruby
22 lines
499 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 < ?', 48.hours.ago).pluck(:id).count > 0
|
||
|
|
||
|
message = PendingFlagsMailer.notify
|
||
|
Email::Sender.new(message, :pending_flags_reminder).send
|
||
|
end
|
||
|
end
|
||
|
|
||
|
end
|
||
|
|
||
|
end
|