2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-12 21:10:47 +08:00

FIX: send the queued posts reminder as a message to moderators instead of an email to the contact_email

This commit is contained in:
Neil Lalonde 2017-09-12 17:44:31 -04:00
parent 31ecb4fecf
commit beea5cac48
4 changed files with 41 additions and 34 deletions

View file

@ -4,13 +4,20 @@ module Jobs
every 1.hour

def execute(args)
return true unless SiteSetting.notify_about_queued_posts_after > 0 && SiteSetting.contact_email
return true unless SiteSetting.notify_about_queued_posts_after > 0

queued_post_ids = should_notify_ids

if queued_post_ids.size > 0 && last_notified_id.to_i < queued_post_ids.max
message = PendingQueuedPostsMailer.notify(count: queued_post_ids.size)
Email::Sender.new(message, :pending_queued_posts_reminder).send
PostCreator.create(
Discourse.system_user,
target_group_names: Group[:moderators].name,
archetype: Archetype.private_message,
subtype: TopicSubtype.system_message,
title: I18n.t('system_messages.queued_posts_reminder.subject_template', count: queued_post_ids.size),
raw: I18n.t('system_messages.queued_posts_reminder.text_body_template', base_url: Discourse.base_url)
)

self.last_notified_id = queued_post_ids.max
end