discourse/app
Martin Brennan bd25627198
FIX: IMAP post alerter race condition and code improvements (#11711)
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.
2021-01-15 10:54:46 +10:00
..
assets UX: Ellipsis hamburger menu link text when overflowing (#11715) 2021-01-14 18:25:19 -05:00
controllers FEATURE: reason to reject user signup (#11700) 2021-01-15 09:43:26 +11:00
helpers UX: Use appropriate logo on static pages (#11211) 2020-11-12 10:50:55 -08:00
jobs FEATURE: reason to reject user signup (#11700) 2021-01-15 09:43:26 +11:00
mailers FEATURE: reason to reject user signup (#11700) 2021-01-15 09:43:26 +11:00
models FIX: IMAP post alerter race condition and code improvements (#11711) 2021-01-15 10:54:46 +10:00
serializers FEATURE: reason to reject user signup (#11700) 2021-01-15 09:43:26 +11:00
services FIX: IMAP post alerter race condition and code improvements (#11711) 2021-01-15 10:54:46 +10:00
views FIX: Safari iOS page title and url regression when sharing (#11699) 2021-01-13 11:10:43 -05:00