mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 12:13:40 +08:00
bd25627198
This PR fixes a race condition with the IMAP notification code. In the `Email::Receiver` we call the `NewPostManager` to create the post and enqueue jobs and sends alerts via `PostAlerter`. However, if the post alerter reaches the `notify_pm_users` and the `group_notifying_via_smtp` method _before_ the incoming email is updated with the post and topic, we unnecessarily send a notification to the person who just posted. The result of this is that the IMAP syncer re-imports the email sent to the user about their own post, which looks like this in the group inbox: To fix this, we skip the jobs enqueued by `NewPostManager` and only enqueue them with `PostJobsEnqueuer` manually _after_ the incoming email record has been updated with the post and topic. Other improvements: * Moved code to calculate email addresses from `IncomingEmail` records into the topic, with a group passed in, for easier testing and debugging. It is not the responsibility of the post alerter to figure this stuff out. * Add shortcut methods on `IncomingEmail` to split or provide an empty array for to and cc addresses to avoid repetition. |
||
---|---|---|
.. | ||
anonymous_shadow_creator_spec.rb | ||
auto_silence_spec.rb | ||
badge_granter_spec.rb | ||
color_scheme_revisor_spec.rb | ||
destroy_task_spec.rb | ||
email_style_updater_spec.rb | ||
flag_sockpuppets_spec.rb | ||
group_action_logger_spec.rb | ||
group_mentions_updater_spec.rb | ||
group_message_spec.rb | ||
heat_settings_updater_spec.rb | ||
inline_uploads_spec.rb | ||
notification_emailer_spec.rb | ||
post_action_notifier_spec.rb | ||
post_alerter_spec.rb | ||
post_owner_changer_spec.rb | ||
push_notification_pusher_spec.rb | ||
random_topic_selector_spec.rb | ||
search_indexer_spec.rb | ||
site_settings_spec.rb | ||
staff_action_logger_spec.rb | ||
themes_spec.rb | ||
topic_status_updater_spec.rb | ||
topic_timestamp_changer_spec.rb | ||
trust_level_granter_spec.rb | ||
user_activator_spec.rb | ||
user_anonymizer_spec.rb | ||
user_authenticator_spec.rb | ||
user_destroyer_spec.rb | ||
user_merger_spec.rb | ||
user_silencer_spec.rb | ||
user_updater_spec.rb | ||
username_changer_spec.rb | ||
username_checker_service_spec.rb | ||
wildcard_domain_checker_spec.rb | ||
wildcard_url_checker_spec.rb | ||
word_watcher_spec.rb |