Commit Graph

44 Commits

Author SHA1 Message Date
Martin Brennan 2237ba8c9d
FIX: Add topic deleted check to email/sender (#9166)
It already had a deleted post check and log reason, add a topic one too to avoid errors
2020-03-13 10:04:15 +10:00
Daniel Waterworth 59578dfc5b FIX: Notification emails with attachments are incorrectly structured
Two behaviors in the mail gem collide:

 1. Attachments are added as extra parts at the top level,
 2. When there are both text and html parts, the content type is set to
    'multipart/alternative'.

Since attachments aren't alternative renderings, for emails that contain
attachments and both html and text parts, some coercing is necessary.
2020-03-12 15:42:24 +00:00
Gerhard Schlager fd12c414e7 DEV: Refactor helper methods for upload markdown
Follow-up to a61ff167
2019-07-25 16:36:35 +02:00
Gerhard Schlager 7e0eeed292 FEATURE: Add attachments to outgoing emails
This feature is off by default and can can be configured with the `email_total_attachment_size_limit_kb` site setting.

Co-authored-by: Maja Komel <maja.komel@gmail.com>
2019-07-25 15:57:45 +02:00
Daniel Waterworth e219588142 DEV: Prefabrication (test optimization) (#7414)
* Introduced fab!, a helper that creates database state for a group

It's almost identical to let_it_be, except:

 1. It creates a new object for each test by default,
 2. You can disable it using PREFABRICATION=0
2019-05-07 13:12:20 +10:00
Sam Saffron 4ea21fa2d0 DEV: use #frozen_string_literal: true on all spec
This change both speeds up specs (less strings to allocate) and helps catch
cases where methods in Discourse are mutating inputs.

Overall we will be migrating everything to use #frozen_string_literal: true
it will take a while, but this is the first and safest move in this direction
2019-04-30 10:27:42 +10: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
David Taylor 3f9e7eb326 FIX: Respect the disable_emails=non-staff site setting correctly
This reverts commit c279792130.

This commit inadvertently removed all of the non-staff email logic, rather than just for the 'test email' button. 

https://meta.discourse.org/t/112231/5
2019-03-21 21:44:14 +00:00
David Taylor 420c6f8102
FEATURE: Skip sending emails to domains on the `.invalid` TLD (#7162)
This is a reserved TLD which we use when importing users without an email address. https://tools.ietf.org/html/rfc2606
2019-03-13 16:17:59 +00:00
Rishabh c279792130 FIX: Allow sending test e-mails to any email address when disable_email is set to non-staff (#6792) 2018-12-18 16:12:05 +01:00
Régis Hanol f01169d6ff FIX: don't send email when the post was deleted 2018-08-22 13:13:58 +02:00
Guo Xiang Tan fad9c2b971 PERF: Move `EmailLog#reply_key` into new `post_reply_keys` table. 2018-07-24 13:51:53 +08:00
Guo Xiang Tan 3874d40910 Prepare to drop `EmailLog#topic_id`. 2018-07-18 10:22:24 +08:00
Arpit Jalan f9ab3848ed FEATURE: support disabling emails for non-staff users 2018-06-07 18:31:08 +05:30
Régis Hanol 7a13e50aa6 fix build 2018-02-22 11:17:49 +01:00
Guo Xiang Tan 5012d46cbd Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
Régis Hanol 82555ca761 FIX: mail threading wasn't working properly in Mac Mail 2017-02-01 23:02:41 +01:00
Guo Xiang Tan 18f400e652 Remove RSpec given. 2016-12-14 10:29:22 +08:00
Régis Hanol a03287f2ee FIX: 'In-Reply-To' header should default to topic_message_id 2016-11-28 14:18:02 +01:00
Régis Hanol 74b6fe8739 FIX: respect RFCs when setting 'In-Reply-To' and 'References' email headers 2016-11-25 23:25:39 +01:00
Régis Hanol f8caae0be7 FIX: don't overwrite custom email headers when using mandrill/sparkpost 2016-10-30 11:38:55 +01:00
Régis Hanol 84d4ebd910 use 'reply_by_email_address' setting for handling bounce emails using VERP 2016-04-25 20:06:45 +02:00
Sam fad017d842 FEATURE: add support for bounce emails
We now optionally add a Variable Email Return Path to every email we send.
This allows us to cleanly handle email bounces, which in turn will improve
deliverability.
2016-04-18 17:14:01 +10:00
Arpit Jalan c5794ab0f6 allow magic login route emails even when emails are disabled 2016-04-08 11:20:09 +05:30
Régis Hanol 52a6682690 FIX: don't create an EmailLog when we can't send a digest 2016-02-17 17:31:46 +01:00
Andy Waite 3e50313fdc Prepare for separation of RSpec helper files
Since rspec-rails 3, the default installation creates two helper files:
* `spec_helper.rb`
* `rails_helper.rb`

`spec_helper.rb` is intended as a way of running specs that do not
require Rails, whereas `rails_helper.rb` loads Rails (as Discourse's
current `spec_helper.rb` does).

For more information:

https://www.relishapp.com/rspec/rspec-rails/docs/upgrade#default-helper-files

In this commit, I've simply replaced all instances of `spec_helper` with
`rails_helper`, and renamed the original `spec_helper.rb`.

This brings the Discourse project closer to the standard usage of RSpec
in a Rails app.

At present, every spec relies on loading Rails, but there are likely
many that don't need to. In a future pull request, I hope to introduce a
separate, minimal `spec_helper.rb` which can be used in tests which
don't rely on Rails.
2015-12-01 20:39:42 +00:00
Arpit Jalan 897563a309 FIX: List-ID should not contain space 2015-10-21 00:00:06 +05:30
Arpit Jalan e97755ab5d FIX: remove custom Discourse headers in email 2015-01-29 17:25:50 +05:30
Arpit Jalan b0369061e2 FIX: always set a default Message ID in email 2015-01-28 14:49:38 +05:30
Luciano Sousa 0fd98b56d8 few components with rspec3 syntax 2015-01-09 13:34:37 -03:00
Godfrey Chan b1a0cd417d Avoid a deprecation warning by poly-filling #deliver_now and #deliver_now 2014-11-10 01:05:46 -08:00
Arpit Jalan 47d48b4dd8 FEATURE: add Precedence header 2014-10-09 01:40:48 +05:30
Arpit Jalan c53f635b2c include category in List-Id instead of topic 2014-10-09 00:34:27 +05:30
Régis Hanol 77ba2015eb FEATURE: new disable_emails site setting 2014-08-23 11:07:37 +02:00
Jeff Atwood a1482f24d9 remove borked test 2014-06-13 17:03:45 -07:00
Jeff Atwood 679b3fab79 correct broken test, List-ID is correct
see http://www.ietf.org/rfc/rfc2919.txt
2014-06-13 16:45:34 -07:00
Jeff Atwood beaa145572 some email notification header fixes 2014-06-13 15:42:20 -07:00
Robin Ward 013ad0fdda Added `In-Reply-To` and `References` email headers. Additionally removed username from
email replies and new posts to keep the subjects collapsable.
2013-07-08 11:48:40 -04:00
Robin Ward 7f70bc3bbd Add `discourse.forum` to all List-Ids 2013-07-02 15:21:34 -04:00
Robin Ward fab1be7c8e Adds a List-Id header to outgoing mail 2013-07-02 14:13:46 -04:00
Robin Ward 8af9952b25 Change all headers to X-Discourse-* instead of Discourse-* 2013-06-18 15:54:02 -04:00
Robin Ward 8acdc18bc8 First stab at polling support for POP3S / reply by email 2013-06-17 16:49:02 -04:00
Robin Ward 49c09898e2 The EmailBuilder now creates the Reply by Email Key if necessary. 2013-06-13 12:40:06 -04:00
Robin Ward e29f4a3496 Work in Progress: Reply By Email:
- Add support classes and settings to enable reply by email
- Split out Email builder to be more OO, add many specs
2013-06-13 12:39:56 -04:00