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
..
2019-10-03 21:48:56 +03:00
2020-03-06 09:35:55 -05:00
2020-10-19 10:40:55 +01:00
2020-05-18 17:27:37 +08:00
2020-04-28 14:34:41 -04:00
2019-10-02 14:01:53 +10:00
2020-10-14 09:38:57 +10:00
2019-11-18 12:28:35 +05:30
2019-04-30 10:27:42 +10:00
2020-07-24 10:11:30 +08:00
2021-01-12 17:28:33 +02:00
2019-10-02 14:01:53 +10:00
2019-04-30 10:27:42 +10:00
2019-04-30 10:27:42 +10:00
2020-10-15 14:05:48 -04:00
2019-04-30 10:27:42 +10:00
2019-04-30 10:27:42 +10:00
2019-10-04 11:11:03 +10:00
2020-04-28 16:06:35 +10:00
2020-12-18 09:03:51 -06:00
2020-05-15 10:40:36 +08:00
2020-09-29 22:29:03 +05:30
2019-04-30 10:27:42 +10:00
2019-05-07 13:12:20 +10:00
2020-06-09 20:49:32 +05:30
2020-07-27 10:23:54 +10:00
2019-08-07 11:38:58 +02:00
2019-05-07 13:12:20 +10:00
2020-12-23 13:14:19 +11:00
2019-05-07 13:12:20 +10:00
2020-11-11 19:46:13 +00:00
2020-09-10 11:34:48 +02:00
2019-05-07 13:12:20 +10:00
2019-05-07 13:12:20 +10:00
2020-12-02 18:38:26 +05:30
2020-10-26 12:26:43 +02:00
2019-05-07 13:12:20 +10:00
2019-06-03 12:42:29 +10:00
2019-04-30 10:27:42 +10:00
2021-01-07 10:49:49 -06:00
2020-09-28 12:02:25 +01:00
2020-06-18 11:32:14 +03:00
2019-10-02 14:01:53 +10:00
2021-01-13 08:49:29 +10:00
2019-04-30 10:27:42 +10:00
2020-08-07 12:08:59 -04:00
2019-04-30 10:27:42 +10:00
2020-12-04 08:43:42 +11:00
2019-04-30 10:27:42 +10:00
2019-12-06 13:00:28 +11:00
2021-01-11 14:56:08 -05:00
2020-09-09 14:05:41 +08:00
2019-04-30 10:27:42 +10:00
2020-04-08 12:52:36 -04:00
2020-03-10 22:13:17 +01:00
2020-11-23 15:29:22 +02:00
2020-12-09 10:54:41 -06:00
2020-01-09 12:32:05 -05:00
2020-03-24 14:57:44 -07:00
2019-05-07 13:12:20 +10:00
2020-08-10 16:14:15 -06:00
2020-01-02 13:24:24 -03:00
2020-12-04 14:09:05 -03:00
2021-01-15 09:43:26 +11:00
2019-04-30 10:27:42 +10:00
2020-04-24 14:09:51 +10:00
2020-07-27 10:23:54 +10:00
2019-04-30 10:27:42 +10:00
2019-12-03 10:05:53 +01:00
2020-07-27 10:23:54 +10:00
2021-01-07 11:15:38 -05:00
2019-04-30 10:27:42 +10:00
2019-04-30 10:27:42 +10:00
2020-03-13 12:25:58 -04:00
2020-12-02 12:36:41 +05:30
2020-10-14 13:15:54 -04:00
2020-11-25 10:49:12 +11:00
2020-03-12 16:35:28 +00:00
2020-09-15 09:26:33 +02:00
2019-04-30 10:27:42 +10:00
2019-11-26 16:39:14 +11:00
2019-04-30 10:27:42 +10:00
2020-04-03 16:42:01 +01:00
2020-12-03 17:16:01 -05:00
2019-04-30 10:27:42 +10:00
2019-12-12 13:10:46 -05:00
2019-04-30 10:27:42 +10:00
2020-09-28 12:02:25 +01:00
2020-05-13 16:05:57 +10:00
2020-12-11 14:20:48 +02:00
2019-11-18 09:43:14 -05:00
2019-05-07 13:12:20 +10:00
2021-01-15 10:54:46 +10:00
2019-05-07 13:12:20 +10:00
2020-10-27 12:39:52 +11:00
2021-01-13 08:49:29 +10:00
2020-12-10 16:49:05 +11:00
2020-11-11 19:46:13 +00:00
2019-04-30 10:27:42 +10:00
2020-09-28 13:52:05 +10:00
2020-04-17 17:24:14 +01:00
2019-10-02 14:01:53 +10:00
2020-10-13 16:17:06 +03:00
2020-03-10 22:13:17 +01:00
2020-10-19 10:40:55 +01:00
2019-04-30 10:27:42 +10:00
2020-03-10 22:13:17 +01:00
2020-04-08 07:35:42 +10:00
2020-01-14 14:26:49 +00:00
2020-07-16 18:21:30 +05:30
2019-07-25 19:41:25 +05:30
2019-04-30 10:27:42 +10:00
2019-05-07 13:12:20 +10:00
2020-08-14 19:10:56 +05:30
2020-09-10 12:59:51 -03:00
2019-05-07 13:12:20 +10:00
2019-10-28 11:01:47 +00:00
2019-04-30 10:27:42 +10:00
2021-01-08 10:40:00 -03:00
2020-09-09 14:05:41 +08:00
2019-04-30 10:27:42 +10:00
2019-05-07 13:12:20 +10:00
2020-07-27 10:23:54 +10:00
2020-03-10 22:13:17 +01:00
2019-12-03 10:05:53 +01:00
2019-04-30 10:27:42 +10:00
2020-04-08 14:38:30 -07:00