actionmailer 6.0.3.1 → 6.1.0.rc2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of actionmailer might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -114
- data/MIT-LICENSE +1 -1
- data/lib/action_mailer.rb +2 -1
- data/lib/action_mailer/base.rb +47 -41
- data/lib/action_mailer/delivery_job.rb +1 -1
- data/lib/action_mailer/delivery_methods.rb +1 -1
- data/lib/action_mailer/gem_version.rb +3 -3
- data/lib/action_mailer/log_subscriber.rb +0 -6
- data/lib/action_mailer/message_delivery.rb +28 -1
- data/lib/action_mailer/preview.rb +1 -1
- data/lib/action_mailer/railtie.rb +0 -5
- data/lib/rails/generators/mailer/USAGE +2 -3
- metadata +28 -14
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 9bb1d45d4d7dc94ca9509ecc82263c62abb248023cf4f81535472f1d5473b91b
         | 
| 4 | 
            +
              data.tar.gz: 73d84f479d82de3827b9aea0700c3ec14636784ed20e26e418a7623aed13a274
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 817c09a6cf8f392457d4ae647176598d91488bf11840462279a7f217f7e3ab2912451f9e1811a720e1bd611146e369eb2eb1aeb406e4e2dbae4e8c3ab13c6ead
         | 
| 7 | 
            +
              data.tar.gz: 6d7e6e7a6526c41447489bc0e29cc78abb5e56a1b72745d3110d92af89b3384c7c41d89e2d3ff7e187707d65d338124628b77e6e5a895bc9db2e79df572bec1c
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    | @@ -1,128 +1,21 @@ | |
| 1 | 
            -
            ## Rails 6.0. | 
| 1 | 
            +
            ## Rails 6.1.0.rc2 (December 01, 2020) ##
         | 
| 2 2 |  | 
| 3 3 | 
             
            *   No changes.
         | 
| 4 4 |  | 
| 5 5 |  | 
| 6 | 
            -
            ## Rails 6.0. | 
| 7 | 
            -
             | 
| 8 | 
            -
            *   No changes.
         | 
| 9 | 
            -
             | 
| 10 | 
            -
             | 
| 11 | 
            -
            ## Rails 6.0.2.2 (March 19, 2020) ##
         | 
| 12 | 
            -
             | 
| 13 | 
            -
            *   No changes.
         | 
| 14 | 
            -
             | 
| 15 | 
            -
             | 
| 16 | 
            -
            ## Rails 6.0.2.1 (December 18, 2019) ##
         | 
| 17 | 
            -
             | 
| 18 | 
            -
            *   No changes.
         | 
| 6 | 
            +
            ## Rails 6.1.0.rc1 (November 02, 2020) ##
         | 
| 19 7 |  | 
| 8 | 
            +
            *   Remove deprecated `ActionMailer::Base.receive` in favor of [Action Mailbox](https://github.com/rails/rails/tree/master/actionmailbox).
         | 
| 20 9 |  | 
| 21 | 
            -
             | 
| 10 | 
            +
                *Rafael Mendonça França*
         | 
| 22 11 |  | 
| 23 12 | 
             
            *   Fix ActionMailer assertions don't work for parameterized mail with legacy delivery job.
         | 
| 24 13 |  | 
| 25 14 | 
             
                *bogdanvlviv*
         | 
| 26 15 |  | 
| 16 | 
            +
            *   Added `email_address_with_name` to properly escape addresses with names.
         | 
| 27 17 |  | 
| 28 | 
            -
             | 
| 29 | 
            -
             | 
| 30 | 
            -
            *   No changes.
         | 
| 31 | 
            -
             | 
| 32 | 
            -
             | 
| 33 | 
            -
            ## Rails 6.0.0 (August 16, 2019) ##
         | 
| 34 | 
            -
             | 
| 35 | 
            -
            *   No changes.
         | 
| 36 | 
            -
             | 
| 37 | 
            -
             | 
| 38 | 
            -
            ## Rails 6.0.0.rc2 (July 22, 2019) ##
         | 
| 39 | 
            -
             | 
| 40 | 
            -
            *   No changes.
         | 
| 41 | 
            -
             | 
| 42 | 
            -
             | 
| 43 | 
            -
            ## Rails 6.0.0.rc1 (April 24, 2019) ##
         | 
| 44 | 
            -
             | 
| 45 | 
            -
            *   No changes.
         | 
| 46 | 
            -
             | 
| 47 | 
            -
             | 
| 48 | 
            -
            ## Rails 6.0.0.beta3 (March 11, 2019) ##
         | 
| 49 | 
            -
             | 
| 50 | 
            -
            *   No changes.
         | 
| 51 | 
            -
             | 
| 52 | 
            -
             | 
| 53 | 
            -
            ## Rails 6.0.0.beta2 (February 25, 2019) ##
         | 
| 54 | 
            -
             | 
| 55 | 
            -
            *   No changes.
         | 
| 56 | 
            -
             | 
| 57 | 
            -
             | 
| 58 | 
            -
            ## Rails 6.0.0.beta1 (January 18, 2019) ##
         | 
| 59 | 
            -
             | 
| 60 | 
            -
            *   Deprecate `ActionMailer::Base.receive` in favor of [Action Mailbox](https://github.com/rails/rails/tree/master/actionmailbox).
         | 
| 61 | 
            -
             | 
| 62 | 
            -
                *George Claghorn*
         | 
| 63 | 
            -
             | 
| 64 | 
            -
            *   Add `MailDeliveryJob` for delivering both regular and parameterized mail. Deprecate using `DeliveryJob` and `Parameterized::DeliveryJob`.
         | 
| 65 | 
            -
             | 
| 66 | 
            -
                *Gannon McGibbon*
         | 
| 67 | 
            -
             | 
| 68 | 
            -
            *   Fix ActionMailer assertions not working when a Mail defines
         | 
| 69 | 
            -
                a custom delivery job class
         | 
| 70 | 
            -
             | 
| 71 | 
            -
                *Edouard Chin*
         | 
| 72 | 
            -
             | 
| 73 | 
            -
            *   Mails with multipart `format` blocks with implicit render now also check for
         | 
| 74 | 
            -
                a template name in options hash instead of only using the action name.
         | 
| 75 | 
            -
             | 
| 76 | 
            -
                *Marcus Ilgner*
         | 
| 77 | 
            -
             | 
| 78 | 
            -
            *   `ActionDispatch::IntegrationTest` includes `ActionMailer::TestHelper` module by default.
         | 
| 79 | 
            -
             | 
| 80 | 
            -
                *Ricardo Díaz*
         | 
| 81 | 
            -
             | 
| 82 | 
            -
            *   Add `perform_deliveries` to a payload of `deliver.action_mailer` notification.
         | 
| 83 | 
            -
             | 
| 84 | 
            -
                *Yoshiyuki Kinjo*
         | 
| 85 | 
            -
             | 
| 86 | 
            -
            *   Change delivery logging message when `perform_deliveries` is false.
         | 
| 87 | 
            -
             | 
| 88 | 
            -
                *Yoshiyuki Kinjo*
         | 
| 89 | 
            -
             | 
| 90 | 
            -
            *   Allow call `assert_enqueued_email_with` with no block.
         | 
| 91 | 
            -
             | 
| 92 | 
            -
                Example:
         | 
| 93 | 
            -
                ```
         | 
| 94 | 
            -
                def test_email
         | 
| 95 | 
            -
                  ContactMailer.welcome.deliver_later
         | 
| 96 | 
            -
                  assert_enqueued_email_with ContactMailer, :welcome
         | 
| 97 | 
            -
                end
         | 
| 98 | 
            -
             | 
| 99 | 
            -
                def test_email_with_arguments
         | 
| 100 | 
            -
                  ContactMailer.welcome("Hello", "Goodbye").deliver_later
         | 
| 101 | 
            -
                  assert_enqueued_email_with ContactMailer, :welcome, args: ["Hello", "Goodbye"]
         | 
| 102 | 
            -
                end
         | 
| 103 | 
            -
                ```
         | 
| 104 | 
            -
             | 
| 105 | 
            -
                *bogdanvlviv*
         | 
| 106 | 
            -
             | 
| 107 | 
            -
            *   Ensure mail gem is eager autoloaded when eager load is true to prevent thread deadlocks.
         | 
| 108 | 
            -
             | 
| 109 | 
            -
                *Samuel Cochran*
         | 
| 110 | 
            -
             | 
| 111 | 
            -
            *   Perform email jobs in `assert_emails`.
         | 
| 112 | 
            -
             | 
| 113 | 
            -
                *Gannon McGibbon*
         | 
| 114 | 
            -
             | 
| 115 | 
            -
            *   Add `Base.unregister_observer`, `Base.unregister_observers`,
         | 
| 116 | 
            -
                `Base.unregister_interceptor`, `Base.unregister_interceptors`,
         | 
| 117 | 
            -
                `Base.unregister_preview_interceptor` and `Base.unregister_preview_interceptors`.
         | 
| 118 | 
            -
                This makes it possible to dynamically add and remove email observers and
         | 
| 119 | 
            -
                interceptors at runtime in the same way they're registered.
         | 
| 120 | 
            -
             | 
| 121 | 
            -
                *Claudio Ortolina*, *Kota Miyake*
         | 
| 122 | 
            -
             | 
| 123 | 
            -
            *   Rails 6 requires Ruby 2.5.0 or newer.
         | 
| 124 | 
            -
             | 
| 125 | 
            -
                *Jeremy Daer*, *Kasper Timm Hansen*
         | 
| 18 | 
            +
                *Sunny Ripert*
         | 
| 126 19 |  | 
| 127 20 |  | 
| 128 | 
            -
            Please check [ | 
| 21 | 
            +
            Please check [6-0-stable](https://github.com/rails/rails/blob/6-0-stable/actionmailer/CHANGELOG.md) for previous changes.
         | 
    
        data/MIT-LICENSE
    CHANGED
    
    
    
        data/lib/action_mailer.rb
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            # frozen_string_literal: true
         | 
| 2 2 |  | 
| 3 3 | 
             
            #--
         | 
| 4 | 
            -
            # Copyright (c) 2004- | 
| 4 | 
            +
            # Copyright (c) 2004-2020 David Heinemeier Hansson
         | 
| 5 5 | 
             
            #
         | 
| 6 6 | 
             
            # Permission is hereby granted, free of charge, to any person obtaining
         | 
| 7 7 | 
             
            # a copy of this software and associated documentation files (the
         | 
| @@ -67,4 +67,5 @@ autoload :Mime, "action_dispatch/http/mime_type" | |
| 67 67 | 
             
            ActiveSupport.on_load(:action_view) do
         | 
| 68 68 | 
             
              ActionView::Base.default_formats ||= Mime::SET.symbols
         | 
| 69 69 | 
             
              ActionView::Template::Types.delegate_to Mime
         | 
| 70 | 
            +
              ActionView::LookupContext::DetailsKey.clear
         | 
| 70 71 | 
             
            end
         | 
    
        data/lib/action_mailer/base.rb
    CHANGED
    
    | @@ -16,11 +16,11 @@ module ActionMailer | |
| 16 16 | 
             
              #
         | 
| 17 17 | 
             
              # To use Action Mailer, you need to create a mailer model.
         | 
| 18 18 | 
             
              #
         | 
| 19 | 
            -
              #   $ rails generate mailer Notifier
         | 
| 19 | 
            +
              #   $ bin/rails generate mailer Notifier
         | 
| 20 20 | 
             
              #
         | 
| 21 21 | 
             
              # The generated model inherits from <tt>ApplicationMailer</tt> which in turn
         | 
| 22 22 | 
             
              # inherits from <tt>ActionMailer::Base</tt>. A mailer model defines methods
         | 
| 23 | 
            -
              # used to generate an email message. In these methods, you can  | 
| 23 | 
            +
              # used to generate an email message. In these methods, you can set up variables to be used in
         | 
| 24 24 | 
             
              # the mailer views, options on the mail itself such as the <tt>:from</tt> address, and attachments.
         | 
| 25 25 | 
             
              #
         | 
| 26 26 | 
             
              #   class ApplicationMailer < ActionMailer::Base
         | 
| @@ -455,10 +455,6 @@ module ActionMailer | |
| 455 455 |  | 
| 456 456 | 
             
                PROTECTED_IVARS = AbstractController::Rendering::DEFAULT_PROTECTED_INSTANCE_VARIABLES + [:@_action_has_layout]
         | 
| 457 457 |  | 
| 458 | 
            -
                def _protected_ivars # :nodoc:
         | 
| 459 | 
            -
                  PROTECTED_IVARS
         | 
| 460 | 
            -
                end
         | 
| 461 | 
            -
             | 
| 462 458 | 
             
                helper ActionMailer::MailHelper
         | 
| 463 459 |  | 
| 464 460 | 
             
                class_attribute :delivery_job, default: ::ActionMailer::DeliveryJob
         | 
| @@ -551,32 +547,6 @@ module ActionMailer | |
| 551 547 | 
             
                  #    config.action_mailer.default_options = { from: "no-reply@example.org" }
         | 
| 552 548 | 
             
                  alias :default_options= :default
         | 
| 553 549 |  | 
| 554 | 
            -
                  # Receives a raw email, parses it into an email object, decodes it,
         | 
| 555 | 
            -
                  # instantiates a new mailer, and passes the email object to the mailer
         | 
| 556 | 
            -
                  # object's +receive+ method.
         | 
| 557 | 
            -
                  #
         | 
| 558 | 
            -
                  # If you want your mailer to be able to process incoming messages, you'll
         | 
| 559 | 
            -
                  # need to implement a +receive+ method that accepts the raw email string
         | 
| 560 | 
            -
                  # as a parameter:
         | 
| 561 | 
            -
                  #
         | 
| 562 | 
            -
                  #   class MyMailer < ActionMailer::Base
         | 
| 563 | 
            -
                  #     def receive(mail)
         | 
| 564 | 
            -
                  #       # ...
         | 
| 565 | 
            -
                  #     end
         | 
| 566 | 
            -
                  #   end
         | 
| 567 | 
            -
                  def receive(raw_mail)
         | 
| 568 | 
            -
                    ActiveSupport::Deprecation.warn(<<~MESSAGE.squish)
         | 
| 569 | 
            -
                      ActionMailer::Base.receive is deprecated and will be removed in Rails 6.1.
         | 
| 570 | 
            -
                      Use Action Mailbox to process inbound email.
         | 
| 571 | 
            -
                    MESSAGE
         | 
| 572 | 
            -
             | 
| 573 | 
            -
                    ActiveSupport::Notifications.instrument("receive.action_mailer") do |payload|
         | 
| 574 | 
            -
                      mail = Mail.new(raw_mail)
         | 
| 575 | 
            -
                      set_payload_for_mail(payload, mail)
         | 
| 576 | 
            -
                      new.receive(mail)
         | 
| 577 | 
            -
                    end
         | 
| 578 | 
            -
                  end
         | 
| 579 | 
            -
             | 
| 580 550 | 
             
                  # Wraps an email delivery inside of <tt>ActiveSupport::Notifications</tt> instrumentation.
         | 
| 581 551 | 
             
                  #
         | 
| 582 552 | 
             
                  # This method is actually called by the <tt>Mail::Message</tt> object itself
         | 
| @@ -590,6 +560,14 @@ module ActionMailer | |
| 590 560 | 
             
                    end
         | 
| 591 561 | 
             
                  end
         | 
| 592 562 |  | 
| 563 | 
            +
                  # Returns an email in the format "Name <email@example.com>".
         | 
| 564 | 
            +
                  def email_address_with_name(address, name)
         | 
| 565 | 
            +
                    Mail::Address.new.tap do |builder|
         | 
| 566 | 
            +
                      builder.address = address
         | 
| 567 | 
            +
                      builder.display_name = name
         | 
| 568 | 
            +
                    end.to_s
         | 
| 569 | 
            +
                  end
         | 
| 570 | 
            +
             | 
| 593 571 | 
             
                private
         | 
| 594 572 | 
             
                  def set_payload_for_mail(payload, mail)
         | 
| 595 573 | 
             
                    payload[:mail]               = mail.encoded
         | 
| @@ -657,6 +635,11 @@ module ActionMailer | |
| 657 635 | 
             
                  self.class.mailer_name
         | 
| 658 636 | 
             
                end
         | 
| 659 637 |  | 
| 638 | 
            +
                # Returns an email in the format "Name <email@example.com>".
         | 
| 639 | 
            +
                def email_address_with_name(address, name)
         | 
| 640 | 
            +
                  self.class.email_address_with_name(address, name)
         | 
| 641 | 
            +
                end
         | 
| 642 | 
            +
             | 
| 660 643 | 
             
                # Allows you to pass random and unusual headers to the new <tt>Mail::Message</tt>
         | 
| 661 644 | 
             
                # object which will add them to itself.
         | 
| 662 645 | 
             
                #
         | 
| @@ -738,7 +721,7 @@ module ActionMailer | |
| 738 721 | 
             
                end
         | 
| 739 722 |  | 
| 740 723 | 
             
                class LateAttachmentsProxy < SimpleDelegator
         | 
| 741 | 
            -
                  def inline;  | 
| 724 | 
            +
                  def inline; self end
         | 
| 742 725 | 
             
                  def []=(_name, _content); _raise_error end
         | 
| 743 726 |  | 
| 744 727 | 
             
                  private
         | 
| @@ -859,8 +842,9 @@ module ActionMailer | |
| 859 842 | 
             
                  @_mail_was_called = true
         | 
| 860 843 |  | 
| 861 844 | 
             
                  create_parts_from_responses(message, responses)
         | 
| 845 | 
            +
                  wrap_inline_attachments(message)
         | 
| 862 846 |  | 
| 863 | 
            -
                  #  | 
| 847 | 
            +
                  # Set up content type, reapply charset and handle parts order
         | 
| 864 848 | 
             
                  message.content_type = set_content_type(message, content_type, headers[:content_type])
         | 
| 865 849 | 
             
                  message.charset      = charset
         | 
| 866 850 |  | 
| @@ -888,7 +872,7 @@ module ActionMailer | |
| 888 872 | 
             
                    when user_content_type.present?
         | 
| 889 873 | 
             
                      user_content_type
         | 
| 890 874 | 
             
                    when m.has_attachments?
         | 
| 891 | 
            -
                      if m.attachments. | 
| 875 | 
            +
                      if m.attachments.all?(&:inline?)
         | 
| 892 876 | 
             
                        ["multipart", "related", params]
         | 
| 893 877 | 
             
                      else
         | 
| 894 878 | 
             
                        ["multipart", "mixed", params]
         | 
| @@ -915,12 +899,9 @@ module ActionMailer | |
| 915 899 | 
             
                  end
         | 
| 916 900 |  | 
| 917 901 | 
             
                  def apply_defaults(headers)
         | 
| 918 | 
            -
                    default_values = self.class.default. | 
| 919 | 
            -
                       | 
| 920 | 
            -
             | 
| 921 | 
            -
                        compute_default(value)
         | 
| 922 | 
            -
                      ]
         | 
| 923 | 
            -
                    end.to_h
         | 
| 902 | 
            +
                    default_values = self.class.default.transform_values do |value|
         | 
| 903 | 
            +
                      compute_default(value)
         | 
| 904 | 
            +
                    end
         | 
| 924 905 |  | 
| 925 906 | 
             
                    headers_with_defaults = headers.reverse_merge(default_values)
         | 
| 926 907 | 
             
                    headers_with_defaults[:subject] ||= default_i18n_subject
         | 
| @@ -989,6 +970,27 @@ module ActionMailer | |
| 989 970 | 
             
                    end
         | 
| 990 971 | 
             
                  end
         | 
| 991 972 |  | 
| 973 | 
            +
                  def wrap_inline_attachments(message)
         | 
| 974 | 
            +
                    # If we have both types of attachment, wrap all the inline attachments
         | 
| 975 | 
            +
                    # in multipart/related, but not the actual attachments
         | 
| 976 | 
            +
                    if message.attachments.detect(&:inline?) && message.attachments.detect { |a| !a.inline? }
         | 
| 977 | 
            +
                      related = Mail::Part.new
         | 
| 978 | 
            +
                      related.content_type = "multipart/related"
         | 
| 979 | 
            +
                      mixed = [ related ]
         | 
| 980 | 
            +
             | 
| 981 | 
            +
                      message.parts.each do |p|
         | 
| 982 | 
            +
                        if p.attachment? && !p.inline?
         | 
| 983 | 
            +
                          mixed << p
         | 
| 984 | 
            +
                        else
         | 
| 985 | 
            +
                          related.add_part(p)
         | 
| 986 | 
            +
                        end
         | 
| 987 | 
            +
                      end
         | 
| 988 | 
            +
             | 
| 989 | 
            +
                      message.parts.clear
         | 
| 990 | 
            +
                      mixed.each { |c| message.add_part(c) }
         | 
| 991 | 
            +
                    end
         | 
| 992 | 
            +
                  end
         | 
| 993 | 
            +
             | 
| 992 994 | 
             
                  def create_parts_from_responses(m, responses)
         | 
| 993 995 | 
             
                    if responses.size == 1 && !m.has_attachments?
         | 
| 994 996 | 
             
                      responses[0].each { |k, v| m[k] = v }
         | 
| @@ -1020,6 +1022,10 @@ module ActionMailer | |
| 1020 1022 | 
             
                    "action_mailer"
         | 
| 1021 1023 | 
             
                  end
         | 
| 1022 1024 |  | 
| 1025 | 
            +
                  def _protected_ivars
         | 
| 1026 | 
            +
                    PROTECTED_IVARS
         | 
| 1027 | 
            +
                  end
         | 
| 1028 | 
            +
             | 
| 1023 1029 | 
             
                  ActiveSupport.run_load_hooks(:action_mailer, self)
         | 
| 1024 1030 | 
             
              end
         | 
| 1025 1031 | 
             
            end
         | 
| @@ -15,7 +15,7 @@ module ActionMailer | |
| 15 15 | 
             
                before_perform do
         | 
| 16 16 | 
             
                  ActiveSupport::Deprecation.warn <<~MSG.squish
         | 
| 17 17 | 
             
                    Sending mail with DeliveryJob and Parameterized::DeliveryJob
         | 
| 18 | 
            -
                    is deprecated and will be removed in Rails 6. | 
| 18 | 
            +
                    is deprecated and will be removed in Rails 6.2.
         | 
| 19 19 | 
             
                    Please use MailDeliveryJob instead.
         | 
| 20 20 | 
             
                  MSG
         | 
| 21 21 | 
             
                end
         | 
| @@ -49,7 +49,7 @@ module ActionMailer | |
| 49 49 | 
             
                  #     arguments: '-i'
         | 
| 50 50 | 
             
                  def add_delivery_method(symbol, klass, default_options = {})
         | 
| 51 51 | 
             
                    class_attribute(:"#{symbol}_settings") unless respond_to?(:"#{symbol}_settings")
         | 
| 52 | 
            -
                     | 
| 52 | 
            +
                    public_send(:"#{symbol}_settings=", default_options)
         | 
| 53 53 | 
             
                    self.delivery_methods = delivery_methods.merge(symbol.to_sym => klass).freeze
         | 
| 54 54 | 
             
                  end
         | 
| 55 55 |  | 
| @@ -20,12 +20,6 @@ module ActionMailer | |
| 20 20 | 
             
                  debug { event.payload[:mail] }
         | 
| 21 21 | 
             
                end
         | 
| 22 22 |  | 
| 23 | 
            -
                # An email was received.
         | 
| 24 | 
            -
                def receive(event)
         | 
| 25 | 
            -
                  info { "Received mail (#{event.duration.round(1)}ms)" }
         | 
| 26 | 
            -
                  debug { event.payload[:mail] }
         | 
| 27 | 
            -
                end
         | 
| 28 | 
            -
             | 
| 29 23 | 
             
                # An email was generated.
         | 
| 30 24 | 
             
                def process(event)
         | 
| 31 25 | 
             
                  debug do
         | 
| @@ -53,12 +53,14 @@ module ActionMailer | |
| 53 53 | 
             
                #   Notifier.welcome(User.first).deliver_later!
         | 
| 54 54 | 
             
                #   Notifier.welcome(User.first).deliver_later!(wait: 1.hour)
         | 
| 55 55 | 
             
                #   Notifier.welcome(User.first).deliver_later!(wait_until: 10.hours.from_now)
         | 
| 56 | 
            +
                #   Notifier.welcome(User.first).deliver_later!(priority: 10)
         | 
| 56 57 | 
             
                #
         | 
| 57 58 | 
             
                # Options:
         | 
| 58 59 | 
             
                #
         | 
| 59 60 | 
             
                # * <tt>:wait</tt> - Enqueue the email to be delivered with a delay
         | 
| 60 61 | 
             
                # * <tt>:wait_until</tt> - Enqueue the email to be delivered at (after) a specific date / time
         | 
| 61 62 | 
             
                # * <tt>:queue</tt> - Enqueue the email on the specified queue
         | 
| 63 | 
            +
                # * <tt>:priority</tt> - Enqueues the email with the specified priority
         | 
| 62 64 | 
             
                #
         | 
| 63 65 | 
             
                # By default, the email will be enqueued using <tt>ActionMailer::DeliveryJob</tt>. Each
         | 
| 64 66 | 
             
                # <tt>ActionMailer::Base</tt> class can specify the job to use by setting the class variable
         | 
| @@ -77,12 +79,14 @@ module ActionMailer | |
| 77 79 | 
             
                #   Notifier.welcome(User.first).deliver_later
         | 
| 78 80 | 
             
                #   Notifier.welcome(User.first).deliver_later(wait: 1.hour)
         | 
| 79 81 | 
             
                #   Notifier.welcome(User.first).deliver_later(wait_until: 10.hours.from_now)
         | 
| 82 | 
            +
                #   Notifier.welcome(User.first).deliver_later(priority: 10)
         | 
| 80 83 | 
             
                #
         | 
| 81 84 | 
             
                # Options:
         | 
| 82 85 | 
             
                #
         | 
| 83 86 | 
             
                # * <tt>:wait</tt> - Enqueue the email to be delivered with a delay.
         | 
| 84 87 | 
             
                # * <tt>:wait_until</tt> - Enqueue the email to be delivered at (after) a specific date / time.
         | 
| 85 88 | 
             
                # * <tt>:queue</tt> - Enqueue the email on the specified queue.
         | 
| 89 | 
            +
                # * <tt>:priority</tt> - Enqueues the email with the specified priority
         | 
| 86 90 | 
             
                #
         | 
| 87 91 | 
             
                # By default, the email will be enqueued using <tt>ActionMailer::DeliveryJob</tt>. Each
         | 
| 88 92 | 
             
                # <tt>ActionMailer::Base</tt> class can specify the job to use by setting the class variable
         | 
| @@ -138,14 +142,37 @@ module ActionMailer | |
| 138 142 | 
             
                    else
         | 
| 139 143 | 
             
                      job = @mailer_class.delivery_job
         | 
| 140 144 |  | 
| 141 | 
            -
                      if job | 
| 145 | 
            +
                      if use_new_args?(job)
         | 
| 142 146 | 
             
                        job.set(options).perform_later(
         | 
| 143 147 | 
             
                          @mailer_class.name, @action.to_s, delivery_method.to_s, args: @args)
         | 
| 148 | 
            +
                      elsif job <= DeliveryJob
         | 
| 149 | 
            +
                        job.set(options).perform_later(
         | 
| 150 | 
            +
                          @mailer_class.name, @action.to_s, delivery_method.to_s, *@args)
         | 
| 144 151 | 
             
                      else
         | 
| 152 | 
            +
                        ActiveSupport::Deprecation.warn(<<~EOM)
         | 
| 153 | 
            +
                          In Rails 6.2, Action Mailer will pass the mail arguments inside the `:args` keyword argument.
         | 
| 154 | 
            +
                          The `perform` method of the #{job} needs to change and forward the mail arguments
         | 
| 155 | 
            +
                          from the `args` keyword argument.
         | 
| 156 | 
            +
             | 
| 157 | 
            +
                          The `perform` method should now look like:
         | 
| 158 | 
            +
             | 
| 159 | 
            +
                          `def perform(mailer, mail_method, delivery, args:)`
         | 
| 160 | 
            +
                        EOM
         | 
| 161 | 
            +
             | 
| 145 162 | 
             
                        job.set(options).perform_later(
         | 
| 146 163 | 
             
                          @mailer_class.name, @action.to_s, delivery_method.to_s, *@args)
         | 
| 147 164 | 
             
                      end
         | 
| 148 165 | 
             
                    end
         | 
| 149 166 | 
             
                  end
         | 
| 167 | 
            +
             | 
| 168 | 
            +
                  def use_new_args?(job)
         | 
| 169 | 
            +
                    parameters = job.public_instance_method(:perform).parameters
         | 
| 170 | 
            +
             | 
| 171 | 
            +
                    parameters.find do |key, name|
         | 
| 172 | 
            +
                      return true if key == :keyreq && name == :args
         | 
| 173 | 
            +
             | 
| 174 | 
            +
                      key == :keyrest
         | 
| 175 | 
            +
                    end
         | 
| 176 | 
            +
                  end
         | 
| 150 177 | 
             
              end
         | 
| 151 178 | 
             
            end
         | 
| @@ -18,11 +18,6 @@ module ActionMailer | |
| 18 18 | 
             
                  paths   = app.config.paths
         | 
| 19 19 | 
             
                  options = app.config.action_mailer
         | 
| 20 20 |  | 
| 21 | 
            -
                  if app.config.force_ssl
         | 
| 22 | 
            -
                    options.default_url_options ||= {}
         | 
| 23 | 
            -
                    options.default_url_options[:protocol] ||= "https"
         | 
| 24 | 
            -
                  end
         | 
| 25 | 
            -
             | 
| 26 21 | 
             
                  options.assets_dir      ||= paths["public"].first
         | 
| 27 22 | 
             
                  options.javascripts_dir ||= paths["public/javascripts"].first
         | 
| 28 23 | 
             
                  options.stylesheets_dir ||= paths["public/stylesheets"].first
         | 
| @@ -1,6 +1,6 @@ | |
| 1 1 | 
             
            Description:
         | 
| 2 2 | 
             
            ============
         | 
| 3 | 
            -
                 | 
| 3 | 
            +
                Generates a new mailer and its views. Passes the mailer name, either
         | 
| 4 4 | 
             
                CamelCased or under_scored, and an optional list of emails as arguments.
         | 
| 5 5 |  | 
| 6 6 | 
             
                This generates a mailer class in app/mailers and invokes your template
         | 
| @@ -8,10 +8,9 @@ Description: | |
| 8 8 |  | 
| 9 9 | 
             
            Example:
         | 
| 10 10 | 
             
            ========
         | 
| 11 | 
            -
                rails generate mailer Notifications signup forgot_password invoice
         | 
| 11 | 
            +
                bin/rails generate mailer Notifications signup forgot_password invoice
         | 
| 12 12 |  | 
| 13 13 | 
             
                creates a Notifications mailer class, views, and test:
         | 
| 14 14 | 
             
                    Mailer:     app/mailers/notifications_mailer.rb
         | 
| 15 15 | 
             
                    Views:      app/views/notifications_mailer/signup.text.erb [...]
         | 
| 16 16 | 
             
                    Test:       test/mailers/notifications_mailer_test.rb
         | 
| 17 | 
            -
             | 
    
        metadata
    CHANGED
    
    | @@ -1,57 +1,71 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: actionmailer
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 6.0. | 
| 4 | 
            +
              version: 6.1.0.rc2
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - David Heinemeier Hansson
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2020- | 
| 11 | 
            +
            date: 2020-12-01 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 14 | 
            +
              name: activesupport
         | 
| 15 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 16 | 
            +
                requirements:
         | 
| 17 | 
            +
                - - '='
         | 
| 18 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 19 | 
            +
                    version: 6.1.0.rc2
         | 
| 20 | 
            +
              type: :runtime
         | 
| 21 | 
            +
              prerelease: false
         | 
| 22 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 23 | 
            +
                requirements:
         | 
| 24 | 
            +
                - - '='
         | 
| 25 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 26 | 
            +
                    version: 6.1.0.rc2
         | 
| 13 27 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 28 | 
             
              name: actionpack
         | 
| 15 29 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 16 30 | 
             
                requirements:
         | 
| 17 31 | 
             
                - - '='
         | 
| 18 32 | 
             
                  - !ruby/object:Gem::Version
         | 
| 19 | 
            -
                    version: 6.0. | 
| 33 | 
            +
                    version: 6.1.0.rc2
         | 
| 20 34 | 
             
              type: :runtime
         | 
| 21 35 | 
             
              prerelease: false
         | 
| 22 36 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 23 37 | 
             
                requirements:
         | 
| 24 38 | 
             
                - - '='
         | 
| 25 39 | 
             
                  - !ruby/object:Gem::Version
         | 
| 26 | 
            -
                    version: 6.0. | 
| 40 | 
            +
                    version: 6.1.0.rc2
         | 
| 27 41 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 28 42 | 
             
              name: actionview
         | 
| 29 43 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 30 44 | 
             
                requirements:
         | 
| 31 45 | 
             
                - - '='
         | 
| 32 46 | 
             
                  - !ruby/object:Gem::Version
         | 
| 33 | 
            -
                    version: 6.0. | 
| 47 | 
            +
                    version: 6.1.0.rc2
         | 
| 34 48 | 
             
              type: :runtime
         | 
| 35 49 | 
             
              prerelease: false
         | 
| 36 50 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 37 51 | 
             
                requirements:
         | 
| 38 52 | 
             
                - - '='
         | 
| 39 53 | 
             
                  - !ruby/object:Gem::Version
         | 
| 40 | 
            -
                    version: 6.0. | 
| 54 | 
            +
                    version: 6.1.0.rc2
         | 
| 41 55 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 42 56 | 
             
              name: activejob
         | 
| 43 57 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 44 58 | 
             
                requirements:
         | 
| 45 59 | 
             
                - - '='
         | 
| 46 60 | 
             
                  - !ruby/object:Gem::Version
         | 
| 47 | 
            -
                    version: 6.0. | 
| 61 | 
            +
                    version: 6.1.0.rc2
         | 
| 48 62 | 
             
              type: :runtime
         | 
| 49 63 | 
             
              prerelease: false
         | 
| 50 64 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 51 65 | 
             
                requirements:
         | 
| 52 66 | 
             
                - - '='
         | 
| 53 67 | 
             
                  - !ruby/object:Gem::Version
         | 
| 54 | 
            -
                    version: 6.0. | 
| 68 | 
            +
                    version: 6.1.0.rc2
         | 
| 55 69 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 56 70 | 
             
              name: mail
         | 
| 57 71 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -123,10 +137,10 @@ licenses: | |
| 123 137 | 
             
            - MIT
         | 
| 124 138 | 
             
            metadata:
         | 
| 125 139 | 
             
              bug_tracker_uri: https://github.com/rails/rails/issues
         | 
| 126 | 
            -
              changelog_uri: https://github.com/rails/rails/blob/v6.0. | 
| 127 | 
            -
              documentation_uri: https://api.rubyonrails.org/v6.0. | 
| 140 | 
            +
              changelog_uri: https://github.com/rails/rails/blob/v6.1.0.rc2/actionmailer/CHANGELOG.md
         | 
| 141 | 
            +
              documentation_uri: https://api.rubyonrails.org/v6.1.0.rc2/
         | 
| 128 142 | 
             
              mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
         | 
| 129 | 
            -
              source_code_uri: https://github.com/rails/rails/tree/v6.0. | 
| 143 | 
            +
              source_code_uri: https://github.com/rails/rails/tree/v6.1.0.rc2/actionmailer
         | 
| 130 144 | 
             
            post_install_message: 
         | 
| 131 145 | 
             
            rdoc_options: []
         | 
| 132 146 | 
             
            require_paths:
         | 
| @@ -138,12 +152,12 @@ required_ruby_version: !ruby/object:Gem::Requirement | |
| 138 152 | 
             
                  version: 2.5.0
         | 
| 139 153 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 140 154 | 
             
              requirements:
         | 
| 141 | 
            -
              - - " | 
| 155 | 
            +
              - - ">"
         | 
| 142 156 | 
             
                - !ruby/object:Gem::Version
         | 
| 143 | 
            -
                  version:  | 
| 157 | 
            +
                  version: 1.3.1
         | 
| 144 158 | 
             
            requirements:
         | 
| 145 159 | 
             
            - none
         | 
| 146 | 
            -
            rubygems_version: 3.1. | 
| 160 | 
            +
            rubygems_version: 3.1.4
         | 
| 147 161 | 
             
            signing_key: 
         | 
| 148 162 | 
             
            specification_version: 4
         | 
| 149 163 | 
             
            summary: Email composition and delivery framework (part of Rails).
         |