Commit Graph

58 Commits

Author SHA1 Message Date
Sam Saffron
0c52537f10 DEV: update rubocop to version 0.77
We like to stay as close as possible to latest with rubocop cause the cops
get better.

This update required some code changes, specifically the default is to avoid
explicit returns where implicit is done

Also this renames a few rules
2019-12-10 11:48:39 +11:00
Dan Ungureanu
086b46051c
FIX: Zeitwerk-related fixes for jobs. (#8187) 2019-10-14 13:03:22 +03:00
Krzysztof Kotlarek
427d54b2b0 DEV: Upgrading Discourse to Zeitwerk (#8098)
Zeitwerk simplifies working with dependencies in dev and makes it easier reloading class chains. 

We no longer need to use Rails "require_dependency" anywhere and instead can just use standard 
Ruby patterns to require files.

This is a far reaching change and we expect some followups here.
2019-10-02 14:01:53 +10:00
Gerhard Schlager
d513c28e3b FIX: Don't send notification email when user isn't allowed to see topic 2019-07-01 14:03:03 +02:00
Sam Saffron
30990006a9 DEV: enable frozen string literal on all files
This reduces chances of errors where consumers of strings mutate inputs
and reduces memory usage of the app.

Test suite passes now, but there may be some stuff left, so we will run
a few sites on a branch prior to merging
2019-05-13 09:31:32 +08:00
Guo Xiang Tan
152238b4cf DEV: Prefer public_send over send. 2019-05-07 09:33:21 +08:00
Neil Lalonde
399e937a38 FIX: prevent sending multiple summary emails due to Sidekiq delays 2019-03-22 12:34:34 -04:00
David Taylor
a9d5ffbe3d FIX: Prevent critical emails bypassing disable, and improve email test logic
- The test_email job is removed, because it was always being run synchronously (not in sidekiq)
- 34b29f62 added a bypass for critical emails, to match the spec. This removes the bypass, and removes the spec.
- This adapts the specs for 72ffabf6, so that they check for emails being sent
- This reimplements c2797921, allowing test emails to be sent even when emails are disabled
2019-03-22 17:28:43 +08:00
Penar Musaraj
9334d2f4f7
FEATURE: add more granular user option levels for email notifications (#7143)
Migrates email user options to a new data structure, where `email_always`, `email_direct` and `email_private_messages` are replace by

* `email_messages_level`, with options: `always`, `only_when_away` and `never` (defaults to `always`)
* `email_level`, with options: `always`, `only_when_away` and `never` (defaults to `only_when_away`)
2019-03-15 10:55:11 -04:00
Guo Xiang Tan
34b29f62db DEV: Remove the use of stubs and mocks in Jobs::UserEmail tests.
We can only be sure that an email is sent when we get a mailer in
`ActionMailer::Deliveries`. A couple of tests were actually incorrect
because it didn't flow through our email sender where there are more
conditions in determining whether an email is sent or not.
2019-03-12 09:39:16 +08:00
Bianca Nenciu
6a3767cde7 FEATURE: Warn users via email about suspicious logins. (#6520)
* FEATURE: Warn users via email about suspicious logins.

* DEV: Move suspicious login check to a job.
2018-10-25 09:45:31 +00:00
Robin Ward
02da022c70
PERF: Quit out of the email job quickly if disabled (#6423)
This prevents sidekiq from doing a bunch of queries when email is
disabled.

Critical emails are a special case and will be sent.
2018-10-01 01:15:45 +08:00
Sam
740308675b FEATURE: erode bounce score every time an email is sent
Introduces a hidden setting (default is 0.1) that erodes bounce score
every time we send an email. This means that erratic failures are less
painful cause system auto corrects
2018-08-28 17:02:12 +10:00
Guo Xiang Tan
8bdf14834b PERF: Restrict number of skipped email log for Jobs::UserEmail. 2018-08-21 11:14:43 +08:00
Guo Xiang Tan
ae8b0a517f PERF: Split skipped email logs into a seperate table. 2018-07-24 13:14:37 +08:00
Sam
24abf38d38 PERF: lower the priority on user emails
User emails can wait behind other regular jobs, they are usually somewhat
slower as they involve smtp transactions
2018-05-22 15:20:55 +10:00
Robin Ward
677b016387 Send a suspension message via email to a user 2017-09-25 12:26:41 -04:00
Guo Xiang Tan
23b787e0a6 Require dependency otherwise it causes Sidekiq to lock up in development. 2017-09-25 13:48:59 +08:00
Guo Xiang Tan
5012d46cbd Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
Arpit Jalan
86f1cc8c92 FIX: don't apply max_emails_per_day_per_user on critical emails 2017-05-03 17:07:39 +05:30
Arpit Jalan
cdce060a38 FIX: don't apply max emails per day per user to forgot password 2017-05-03 14:02:37 +05:30
Régis Hanol
23b06d2895 FIX: should not try to send digest to users who reached the bounce threshold 2017-03-08 19:19:11 +01:00
Régis Hanol
cf8bc4483f FIX: always send critical emails even when bounce score threshold has been reached 2017-03-08 10:06:16 +01:00
Arpit Jalan
7a1ff59822 FIX: PM email to suspended member was broken 2017-01-05 13:58:14 +05:30
Sam
f867af6bf9 bye bye byebug 2016-12-15 15:52:25 +11:00
Guo Xiang Tan
3666575b46 UX: Improve styling for groups page. 2016-12-15 12:19:13 +08:00
Arpit Jalan
478418e780 FIX: notify_old_email template did not had new_email 2016-10-25 23:50:55 +05:30
Kiril Staikov
aee943486a FEATURE:'No Echo' option for mailing list mode.
Mailing list mode now includes the 'no echo' option: to only receive emails of posts not created
by you.  If you reply to an email thread in mailing list mode, your reply will not then be echoed
back to you in a duplicate email by the system.
2016-10-19 13:14:36 -04:00
James Kiesel
c2819e99f4 Don't halt notification emails for those on daily mailing list mode 2016-08-03 12:29:38 -04:00
Sam
813fcebdd1 FIX: email_always was not respected correctly
In the past email always meant, email me even if active UNLESS I read post

Now emails always means, always, even if I read the post
2016-07-01 11:22:07 +10:00
Régis Hanol
99ad251731 different email footer when mailing_list_mode is enabled 2016-06-03 15:48:54 +02:00
Guo Xiang Tan
b68860ee28 FIX: Do not send email when user of the post has been deleted. (#4228) 2016-05-17 17:42:15 +02:00
Régis Hanol
d224966a0e FIX: retry sending an email in 1 hour when SMTP server is busy 2016-05-09 20:37:33 +02:00
Régis Hanol
1e57bbf5c8 Lots bounce emails related fixes
- Show bounce score on user admin page
- Added reset bounce score button on user admin page
- Only whitelisted email types are sent to emails with high bounce score
- FIX: properly detect bounces even when there is no TO: header in the email
- Don't desactivate a user when reaching the bounce threshold
2016-05-06 19:34:33 +02:00
Régis Hanol
8e611ec7a1 FEATURE: handle bounced emails 2016-05-02 23:15:32 +02:00
Sam
0119a2f980 FIX: only ever send users 1 email per post
in the past ninja editing a post to add a mention could trigger duplicate
emails to a user (and a few other edge cases)
2016-04-15 15:59:01 +10:00
Sam
c095304d6d FEATURE: limit daily emails per user to 100 per day via site setting
- controlled via max_emails_per_day_per_user, 0 to disable
- when limit is reached user is warned
2016-03-23 15:08:48 +11:00
Robin Ward
5771d2aee2 SECURITY: Support for confirm old as well as new email accounts 2016-03-08 14:52:22 -05:00
Guo Xiang Tan
f89e9024ba FIX: Topic and Post may be nil. 2016-02-24 16:27:28 +08:00
Sam
3829c78526 PERF: shift most user options out of the user table
As it stands we load up user records quite frequently on the topic pages,
this in turn pulls all the columns for the users being selected, just to
discard them after they are loaded

New structure keeps all options in a discrete table, this is better organised
and allows us to easily add more column without worrying about bloating the
user table
2016-02-17 18:08:25 +11:00
Régis Hanol
bf96025507 link email logs to the post that generate the email notification when available 2016-02-16 16:35:57 +01:00
Régis Hanol
4ad5660615 add slightly more logs when skipping email notifications 2016-02-15 17:53:07 +01:00
Régis Hanol
ea0e63b150 FIX: handle cases where we only pass the notification type rather than the notification id when sending user email 2016-02-05 20:07:30 +01:00
Régis Hanol
7d992cb4c5 FIX: sending emails to mailing list subscribers wasn't working 2016-02-03 19:27:58 +01:00
Régis Hanol
96380bfd38 FIX: only create 1 email_log when an email is sent 2016-01-29 16:49:49 +01:00
Régis Hanol
d51019ee53 FIX: *always* create an EmailLog whenever we run the UserEmail job
There were actually 2 bugs:

1/ Calling '.try(:key)' on a hash doesn't work. So EmailLogs were never associated to a user.

2/ Turns out that we update the 'user.last_emailed_at' whenever we create an EmailLog (in the 'after_create' callback).
So we need to always create an EmailLog (whenever the email is sent or skipped).
2016-01-28 19:01:35 +01:00
Sam
1bb485fca5 FIX: when a user got multiple replies to a topic, emails were missing 2016-01-27 12:20:08 +11:00
Sam
1f7c03df5c FIX: missing email notifications for group mentions 2015-12-01 12:12:55 +11:00
Régis Hanol
0d54c18c8b new hidden 'allow_staged_accounts' setting 2015-11-26 18:31:23 +01:00
Régis Hanol
acecfeb37f Add 'staged' boolean to User 2015-11-06 19:19:13 +01:00