discourse/plugins/chat/config/locales
Régis Hanol 71391cd40d PERF: fix performance of chat email notifications
When chat is enabled, there's a scheduled job that runs every 5 minutes to check whether we need to send a "chat summary" email to users with unread chat messages or mentions.

On Discourse with a large number of users, the query used wasn't optimal and sometimes taking minutes. Which isn't good when the query is called every 5 minutes 😬

This PR reworks the query in `Chat::Mailer.send_unread_mentions_summary`.

Instead of starting from the `users` table, it starts from the `user_chat_channel_memberships` table which is the main piece tying everything together.

The new query is mostly similar to the previous one, with some bug fixes (like ensuring the user has `allow_private_messages` enabled for direct messages) and is also slightly simpler since it doesn't keep track of the `memberships_with_unread_messages` anymore. That part has been moved to the `user_notifications.chat_summary` email method.

The `UserEmailExtension` has been deleted since that was using to N+1 update the `user_chat_channel_memberships.last_unread_mention_when_emailed_it`(quite a mouthful 😛) but that's now done directly in the `user_notifications.chat_summary` email method.

The "plat de résistance" of that PR - the `user_notifications.chat_summary` method has been re-worked for improved performances 🚀

Instead of doing everything in one query, it does 4 tiny ones.

- One to retrieve the list of unread mentions (@something) in "category" channels
- One to retrieve the list of unread messages in "direct message" channels (aka. 1-1 and group discussions)
- One to load all the chat messages for each "category" channels from the last unread mention
- One to load all the chat messages for each "direct message" channels from the last unread message

All the specs for both `Chat::Mailer` and `UserNotification.chat_summary` have been rewriten for easier comprehension and faster execution (mostly by not using chat services which makes the specs go 10x slower...)

Internal ref - t/129848
2024-06-10 14:25:06 +02:00
..
client.ar.yml Update translations (#27274) 2024-05-31 12:27:26 +02:00
client.be.yml Update translations (#25476) 2024-01-30 17:05:37 +01:00
client.bg.yml Update translations (#25767) 2024-02-20 09:42:19 -05:00
client.bs_BA.yml Update translations (#25767) 2024-02-20 09:42:19 -05:00
client.ca.yml Update translations (#25767) 2024-02-20 09:42:19 -05:00
client.cs.yml Update translations (#27274) 2024-05-31 12:27:26 +02:00
client.da.yml Update translations (#27274) 2024-05-31 12:27:26 +02:00
client.de.yml Update translations (#27321) 2024-06-04 21:44:04 +02:00
client.el.yml Update translations (#25767) 2024-02-20 09:42:19 -05:00
client.en_GB.yml Update translations (#25278) 2024-01-16 14:54:32 +01:00
client.en.yml UX: add illustrations for empty chat list + split into tabs on drawer (#26910) 2024-05-28 17:00:04 +04:00
client.es.yml Update translations (#27274) 2024-05-31 12:27:26 +02:00
client.et.yml Update translations (#25767) 2024-02-20 09:42:19 -05:00
client.fa_IR.yml Update translations (#27274) 2024-05-31 12:27:26 +02:00
client.fi.yml Update translations (#27274) 2024-05-31 12:27:26 +02:00
client.fr.yml Update translations (#27274) 2024-05-31 12:27:26 +02:00
client.gl.yml Update translations (#25767) 2024-02-20 09:42:19 -05:00
client.he.yml Update translations (#27321) 2024-06-04 21:44:04 +02:00
client.hr.yml Update translations (#27274) 2024-05-31 12:27:26 +02:00
client.hu.yml Update translations (#27274) 2024-05-31 12:27:26 +02:00
client.hy.yml Update translations (#25767) 2024-02-20 09:42:19 -05:00
client.id.yml Update translations (#27321) 2024-06-04 21:44:04 +02:00
client.it.yml Update translations (#27274) 2024-05-31 12:27:26 +02:00
client.ja.yml Update translations (#27274) 2024-05-31 12:27:26 +02:00
client.ko.yml Update translations (#27274) 2024-05-31 12:27:26 +02:00
client.lt.yml Update translations (#27274) 2024-05-31 12:27:26 +02:00
client.lv.yml Update translations (#25767) 2024-02-20 09:42:19 -05:00
client.nb_NO.yml Update translations (#25767) 2024-02-20 09:42:19 -05:00
client.nl.yml Update translations (#27274) 2024-05-31 12:27:26 +02:00
client.pl_PL.yml Update translations (#27321) 2024-06-04 21:44:04 +02:00
client.pt_BR.yml Update translations (#27274) 2024-05-31 12:27:26 +02:00
client.pt.yml Update translations (#27274) 2024-05-31 12:27:26 +02:00
client.ro.yml Update translations (#27274) 2024-05-31 12:27:26 +02:00
client.ru.yml Update translations (#27274) 2024-05-31 12:27:26 +02:00
client.sk.yml Update translations (#27321) 2024-06-04 21:44:04 +02:00
client.sl.yml Update translations (#25767) 2024-02-20 09:42:19 -05:00
client.sq.yml Update translations (#25767) 2024-02-20 09:42:19 -05:00
client.sr.yml Update translations (#25767) 2024-02-20 09:42:19 -05:00
client.sv.yml Update translations (#27274) 2024-05-31 12:27:26 +02:00
client.sw.yml Update translations (#25767) 2024-02-20 09:42:19 -05:00
client.te.yml Update translations (#25476) 2024-01-30 17:05:37 +01:00
client.th.yml Update translations (#25767) 2024-02-20 09:42:19 -05:00
client.tr_TR.yml Update translations (#27274) 2024-05-31 12:27:26 +02:00
client.ug.yml Update translations (#27274) 2024-05-31 12:27:26 +02:00
client.uk.yml Update translations (#27321) 2024-06-04 21:44:04 +02:00
client.ur.yml Update translations (#25767) 2024-02-20 09:42:19 -05:00
client.vi.yml Update translations (#25767) 2024-02-20 09:42:19 -05:00
client.zh_CN.yml Update translations (#27321) 2024-06-04 21:44:04 +02:00
client.zh_TW.yml Update translations (#27274) 2024-05-31 12:27:26 +02:00
server.ar.yml Update translations (#27017) 2024-05-14 16:19:44 +02:00
server.be.yml Update translations (#23408) 2023-09-05 15:42:34 +02:00
server.bg.yml Update translations (#24177) 2023-11-07 21:31:20 +01:00
server.bs_BA.yml Update translations (#23408) 2023-09-05 15:42:34 +02:00
server.ca.yml Update translations (#23408) 2023-09-05 15:42:34 +02:00
server.cs.yml Update translations (#26713) 2024-04-23 16:22:27 +02:00
server.da.yml Update translations (#25278) 2024-01-16 14:54:32 +01:00
server.de.yml Update translations (#27017) 2024-05-14 16:19:44 +02:00
server.el.yml Update translations (#25278) 2024-01-16 14:54:32 +01:00
server.en_GB.yml
server.en.yml PERF: fix performance of chat email notifications 2024-06-10 14:25:06 +02:00
server.es.yml Update translations (#27017) 2024-05-14 16:19:44 +02:00
server.et.yml Update translations (#25278) 2024-01-16 14:54:32 +01:00
server.fa_IR.yml Update translations (#27017) 2024-05-14 16:19:44 +02:00
server.fi.yml Update translations (#27017) 2024-05-14 16:19:44 +02:00
server.fr.yml Update translations (#27017) 2024-05-14 16:19:44 +02:00
server.gl.yml Update translations (#23408) 2023-09-05 15:42:34 +02:00
server.he.yml Update translations (#27017) 2024-05-14 16:19:44 +02:00
server.hr.yml Update translations (#24599) 2023-11-29 10:41:27 +01:00
server.hu.yml Update translations (#24599) 2023-11-29 10:41:27 +01:00
server.hy.yml Update translations (#23408) 2023-09-05 15:42:34 +02:00
server.id.yml Update translations (#27017) 2024-05-14 16:19:44 +02:00
server.it.yml Update translations (#27017) 2024-05-14 16:19:44 +02:00
server.ja.yml Update translations (#27017) 2024-05-14 16:19:44 +02:00
server.ko.yml Update translations (#24599) 2023-11-29 10:41:27 +01:00
server.lt.yml Update translations (#24177) 2023-11-07 21:31:20 +01:00
server.lv.yml Update translations (#23408) 2023-09-05 15:42:34 +02:00
server.nb_NO.yml Update translations (#23408) 2023-09-05 15:42:34 +02:00
server.nl.yml Update translations (#27017) 2024-05-14 16:19:44 +02:00
server.pl_PL.yml Update translations (#27017) 2024-05-14 16:19:44 +02:00
server.pt_BR.yml Update translations (#27017) 2024-05-14 16:19:44 +02:00
server.pt.yml Update translations (#27017) 2024-05-14 16:19:44 +02:00
server.ro.yml Update translations (#27017) 2024-05-14 16:19:44 +02:00
server.ru.yml Update translations (#27017) 2024-05-14 16:19:44 +02:00
server.sk.yml Update translations (#27274) 2024-05-31 12:27:26 +02:00
server.sl.yml Update translations (#23408) 2023-09-05 15:42:34 +02:00
server.sq.yml Update translations (#23408) 2023-09-05 15:42:34 +02:00
server.sr.yml Update translations (#23408) 2023-09-05 15:42:34 +02:00
server.sv.yml Update translations (#27017) 2024-05-14 16:19:44 +02:00
server.sw.yml Update translations (#23408) 2023-09-05 15:42:34 +02:00
server.te.yml Update translations (#20370) 2023-02-20 11:01:01 +01:00
server.th.yml Update translations (#23408) 2023-09-05 15:42:34 +02:00
server.tr_TR.yml Update translations (#27017) 2024-05-14 16:19:44 +02:00
server.ug.yml Update translations (#27274) 2024-05-31 12:27:26 +02:00
server.uk.yml Update translations (#27017) 2024-05-14 16:19:44 +02:00
server.ur.yml Update translations (#24177) 2023-11-07 21:31:20 +01:00
server.vi.yml Update translations (#24177) 2023-11-07 21:31:20 +01:00
server.zh_CN.yml Update translations (#27017) 2024-05-14 16:19:44 +02:00
server.zh_TW.yml Update translations (#24599) 2023-11-29 10:41:27 +01:00