From 3cacaf6d9217be9ee5012b38887c1ac70d101bbc Mon Sep 17 00:00:00 2001 From: Pranav Raj S Date: Fri, 6 Aug 2021 08:02:17 +0530 Subject: [PATCH] chore: Rename MAILER_SENDER_EMAIL to FROM_EMAIL_ADDRESS --- .env.example | 2 +- Gemfile.lock | 33 ++++++++++-------------- app/mailers/application_mailer.rb | 3 ++- app/mailers/conversation_reply_mailer.rb | 2 +- app/models/account.rb | 2 +- config/initializers/devise.rb | 2 +- 6 files changed, 20 insertions(+), 24 deletions(-) diff --git a/.env.example b/.env.example index ea246c6f8..715031b81 100644 --- a/.env.example +++ b/.env.example @@ -41,7 +41,7 @@ RAILS_MAX_THREADS=5 # The email from which all outgoing emails are sent # could user either `email@yourdomain.com` or `BrandName ` -MAILER_SENDER_EMAIL=Chatwoot +FROM_EMAIL_ADDRESS=Chatwoot #SMTP domain key is set up for HELO checking diff --git a/Gemfile.lock b/Gemfile.lock index 533bccb8b..b7c4ff874 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -83,7 +83,7 @@ GEM ast (2.4.2) attr_extras (6.2.4) aws-eventstream (1.1.1) - aws-partitions (1.482.0) + aws-partitions (1.483.0) aws-sdk-core (3.119.0) aws-eventstream (~> 1, >= 1.0.2) aws-partitions (~> 1, >= 1.239.0) @@ -115,7 +115,7 @@ GEM statsd-ruby (~> 1.1) bcrypt (3.1.16) bindex (0.8.1) - bootsnap (1.7.6) + bootsnap (1.7.7) msgpack (~> 1.0) brakeman (5.1.1) browser (5.3.1) @@ -138,7 +138,7 @@ GEM crack (0.4.5) rexml crass (1.0.6) - cypress-on-rails (1.10.1) + cypress-on-rails (1.11.0) rack database_cleaner (2.0.1) database_cleaner-active_record (~> 2.0.0) @@ -214,7 +214,7 @@ GEM grpc (~> 1.25) geocoder (1.6.7) gli (2.20.1) - globalid (0.5.1) + globalid (0.5.2) activesupport (>= 5.0) google-apis-core (0.4.1) addressable (~> 2.5, >= 2.5.1) @@ -249,8 +249,7 @@ GEM google-cloud-core (~> 1.6) googleauth (>= 0.16.2, < 2.a) mini_mime (~> 1.0) - google-protobuf (3.17.3-universal-darwin) - google-protobuf (3.17.3-x86_64-linux) + google-protobuf (3.17.3) googleapis-common-protos (1.3.11) google-protobuf (~> 3.14) googleapis-common-protos-types (>= 1.0.6, < 2.0) @@ -266,10 +265,7 @@ GEM signet (~> 0.14) groupdate (5.2.2) activesupport (>= 5) - grpc (1.38.0-universal-darwin) - google-protobuf (~> 3.15) - googleapis-common-protos-types (~> 1.0) - grpc (1.38.0-x86_64-linux) + grpc (1.38.0) google-protobuf (~> 3.15) googleapis-common-protos-types (~> 1.0) haikunator (1.1.1) @@ -348,6 +344,7 @@ GEM mime-types-data (3.2021.0704) mini_magick (4.11.0) mini_mime (1.1.0) + mini_portile2 (2.5.3) minitest (5.14.4) mock_redis (0.28.0) ruby2_keywords @@ -360,10 +357,9 @@ GEM net-http-persistent (4.0.1) connection_pool (~> 2.2) netrc (0.11.0) - nio4r (2.5.7) - nokogiri (1.11.7-x86_64-darwin) - racc (~> 1.4) - nokogiri (1.11.7-x86_64-linux) + nio4r (2.5.8) + nokogiri (1.11.7) + mini_portile2 (~> 2.5.0) racc (~> 1.4) oauth (0.5.6) orm_adapter (0.5.0) @@ -490,7 +486,7 @@ GEM ruby2ruby (2.4.4) ruby_parser (~> 3.1) sexp_processor (~> 4.6) - ruby_parser (3.16.0) + ruby_parser (3.17.0) sexp_processor (~> 4.15, >= 4.15.1) sassc (2.4.0) ffi (~> 1.9) @@ -604,8 +600,8 @@ GEM activemodel (>= 6.0.0) bindex (>= 0.4.0) railties (>= 6.0.0) - webmock (3.13.0) - addressable (>= 2.3.6) + webmock (3.14.0) + addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) webpacker (5.4.0) @@ -624,8 +620,7 @@ GEM zeitwerk (2.4.2) PLATFORMS - x86_64-darwin-21 - x86_64-linux + ruby DEPENDENCIES active_record_query_trace diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb index 9d5fd0214..b7f31ce6b 100644 --- a/app/mailers/application_mailer.rb +++ b/app/mailers/application_mailer.rb @@ -1,7 +1,8 @@ class ApplicationMailer < ActionMailer::Base include ActionView::Helpers::SanitizeHelper - default from: ENV.fetch('MAILER_SENDER_EMAIL', 'Chatwoot ') + ### Todo: Remove MAILER_SENDER_EMAIL after 4 releases + default from: ENV.fetch('FROM_EMAIL_ADDRESS') || ENV.fetch('MAILER_SENDER_EMAIL', 'Chatwoot ') before_action { ensure_current_account(params.try(:[], :account)) } around_action :switch_locale layout 'mailer/base' diff --git a/app/mailers/conversation_reply_mailer.rb b/app/mailers/conversation_reply_mailer.rb index ea21cbb2d..94b5fbb1b 100644 --- a/app/mailers/conversation_reply_mailer.rb +++ b/app/mailers/conversation_reply_mailer.rb @@ -1,5 +1,5 @@ class ConversationReplyMailer < ApplicationMailer - default from: ENV.fetch('MAILER_SENDER_EMAIL', 'Chatwoot ') + default from: ENV.fetch('FROM_EMAIL_ADDRESS') || ENV.fetch('MAILER_SENDER_EMAIL', 'Chatwoot ') layout :choose_layout def reply_with_summary(conversation, message_queued_time) diff --git a/app/models/account.rb b/app/models/account.rb index 0cfc14293..ed3268b9d 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -100,7 +100,7 @@ class Account < ApplicationRecord end def support_email - super || GlobalConfig.get('MAILER_SUPPORT_EMAIL')['MAILER_SUPPORT_EMAIL'] || ENV.fetch('MAILER_SENDER_EMAIL', 'Chatwoot ') + super || GlobalConfig.get('MAILER_SUPPORT_EMAIL')['MAILER_SUPPORT_EMAIL'] || ENV.fetch('FROM_EMAIL_ADDRESS') || ENV.fetch('MAILER_SENDER_EMAIL', 'Chatwoot ') end private diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index 134005945..21ee51494 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -12,7 +12,7 @@ Devise.setup do |config| # Configure the e-mail address which will be shown in Devise::Mailer, # note that it will be overwritten if you use your own mailer class # with default "from" parameter. - config.mailer_sender = ENV.fetch('MAILER_SENDER_EMAIL', 'Chatwoot ') + config.mailer_sender = ENV.fetch('FROM_EMAIL_ADDRESS') || ENV.fetch('MAILER_SENDER_EMAIL', 'Chatwoot ') # Configure the class responsible to send e-mails. # config.mailer = 'Devise::Mailer'