Commit 61ed5187 authored by Vyacheslav Slinko's avatar Vyacheslav Slinko

Make email display name configurable

parent 21c99e6a
...@@ -34,6 +34,7 @@ v 7.9.0 (unreleased) ...@@ -34,6 +34,7 @@ v 7.9.0 (unreleased)
- Automatically link commit ranges to compare page: sha1...sha4 or sha1..sha4 (includes sha1 in comparison) - Automatically link commit ranges to compare page: sha1...sha4 or sha1..sha4 (includes sha1 in comparison)
- Move groups page from profile to dashboard - Move groups page from profile to dashboard
- Starred projects page at dashboard - Starred projects page at dashboard
- Make email display name configurable
v 7.8.2 v 7.8.2
- Fix service migration issue when upgrading from versions prior to 7.3 - Fix service migration issue when upgrading from versions prior to 7.3
......
...@@ -53,7 +53,7 @@ class Notify < ActionMailer::Base ...@@ -53,7 +53,7 @@ class Notify < ActionMailer::Base
# The default email address to send emails from # The default email address to send emails from
def default_sender_address def default_sender_address
address = Mail::Address.new(Gitlab.config.gitlab.email_from) address = Mail::Address.new(Gitlab.config.gitlab.email_from)
address.display_name = "GitLab" address.display_name = Gitlab.config.gitlab.email_display_name
address address
end end
......
...@@ -43,6 +43,7 @@ production: &base ...@@ -43,6 +43,7 @@ production: &base
# email_enabled: true # email_enabled: true
# Email address used in the "From" field in mails sent by GitLab # Email address used in the "From" field in mails sent by GitLab
email_from: example@example.com email_from: example@example.com
email_display_name: GitLab
# Email server smtp settings are in config/initializers/smtp_settings.rb.sample # Email server smtp settings are in config/initializers/smtp_settings.rb.sample
......
...@@ -102,6 +102,7 @@ Settings.gitlab['relative_url_root'] ||= ENV['RAILS_RELATIVE_URL_ROOT'] || '' ...@@ -102,6 +102,7 @@ Settings.gitlab['relative_url_root'] ||= ENV['RAILS_RELATIVE_URL_ROOT'] || ''
Settings.gitlab['protocol'] ||= Settings.gitlab.https ? "https" : "http" Settings.gitlab['protocol'] ||= Settings.gitlab.https ? "https" : "http"
Settings.gitlab['email_enabled'] ||= true if Settings.gitlab['email_enabled'].nil? Settings.gitlab['email_enabled'] ||= true if Settings.gitlab['email_enabled'].nil?
Settings.gitlab['email_from'] ||= "gitlab@#{Settings.gitlab.host}" Settings.gitlab['email_from'] ||= "gitlab@#{Settings.gitlab.host}"
Settings.gitlab['email_display_name'] ||= "GitLab"
Settings.gitlab['url'] ||= Settings.send(:build_gitlab_url) Settings.gitlab['url'] ||= Settings.send(:build_gitlab_url)
Settings.gitlab['user'] ||= 'git' Settings.gitlab['user'] ||= 'git'
Settings.gitlab['user_home'] ||= begin Settings.gitlab['user_home'] ||= begin
......
...@@ -5,6 +5,7 @@ describe Notify do ...@@ -5,6 +5,7 @@ describe Notify do
include EmailSpec::Matchers include EmailSpec::Matchers
include RepoHelpers include RepoHelpers
let(:gitlab_sender_display_name) { Gitlab.config.gitlab.email_display_name }
let(:gitlab_sender) { Gitlab.config.gitlab.email_from } let(:gitlab_sender) { Gitlab.config.gitlab.email_from }
let(:recipient) { create(:user, email: 'recipient@example.com') } let(:recipient) { create(:user, email: 'recipient@example.com') }
let(:project) { create(:project) } let(:project) { create(:project) }
...@@ -23,7 +24,7 @@ describe Notify do ...@@ -23,7 +24,7 @@ describe Notify do
shared_examples 'an email sent from GitLab' do shared_examples 'an email sent from GitLab' do
it 'is sent from GitLab' do it 'is sent from GitLab' do
sender = subject.header[:from].addrs[0] sender = subject.header[:from].addrs[0]
expect(sender.display_name).to eq('GitLab') expect(sender.display_name).to eq(gitlab_sender_display_name)
expect(sender.address).to eq(gitlab_sender) expect(sender.address).to eq(gitlab_sender)
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment