diff --git a/Gemfile b/Gemfile index f0cb92cfae2..01861f1ffac 100644 --- a/Gemfile +++ b/Gemfile @@ -333,7 +333,7 @@ gem 'newrelic_rpm', '~> 3.16' gem 'octokit', '~> 4.6.2' -gem 'mail_room', '~> 0.9.0' +gem 'mail_room', '~> 0.9.1' gem 'email_reply_trimmer', '~> 0.1' gem 'html2text' diff --git a/Gemfile.lock b/Gemfile.lock index e0c600f64c0..2a3be763753 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -408,7 +408,7 @@ GEM nokogiri (>= 1.5.9) mail (2.6.4) mime-types (>= 1.16, < 4) - mail_room (0.9.0) + mail_room (0.9.1) memoist (0.15.0) method_source (0.8.2) mime-types (2.99.3) @@ -909,7 +909,7 @@ DEPENDENCIES license_finder (~> 2.1.0) licensee (~> 8.0.0) loofah (~> 2.0.3) - mail_room (~> 0.9.0) + mail_room (~> 0.9.1) method_source (~> 0.8) minitest (~> 5.7.0) mousetrap-rails (~> 1.4.6) diff --git a/changelogs/unreleased/1363-redo-mailroom-support.yml b/changelogs/unreleased/1363-redo-mailroom-support.yml new file mode 100644 index 00000000000..8ed206f4fdb --- /dev/null +++ b/changelogs/unreleased/1363-redo-mailroom-support.yml @@ -0,0 +1,4 @@ +--- +title: Redo internals of Incoming Mail Support +merge_request: 9385 +author: diff --git a/config/mail_room.yml b/config/mail_room.yml index 774c5350a45..88d93d4bc6b 100644 --- a/config/mail_room.yml +++ b/config/mail_room.yml @@ -1,9 +1,6 @@ -# If you change this file in a Merge Request, please also create -# a Merge Request on https://gitlab.com/gitlab-org/omnibus-gitlab/merge_requests -# :mailboxes: <% - require_relative "lib/gitlab/mail_room" unless defined?(Gitlab::MailRoom) + require_relative "../lib/gitlab/mail_room" unless defined?(Gitlab::MailRoom) config = Gitlab::MailRoom.config if Gitlab::MailRoom.enabled? diff --git a/lib/tasks/gitlab/check.rake b/lib/tasks/gitlab/check.rake index 35c4194e87c..6102517e730 100644 --- a/lib/tasks/gitlab/check.rake +++ b/lib/tasks/gitlab/check.rake @@ -724,8 +724,11 @@ namespace :gitlab do def check_imap_authentication print "IMAP server credentials are correct? ... " - config_path = Rails.root.join('config', 'mail_room.yml') - config_file = YAML.load(ERB.new(File.read(config_path)).result) + config_path = Rails.root.join('config', 'mail_room.yml').to_s + erb = ERB.new(File.read(config_path)) + erb.filename = config_path + config_file = YAML.load(erb.result) + config = config_file[:mailboxes].first if config diff --git a/spec/config/mail_room_spec.rb b/spec/config/mail_room_spec.rb index 294fae95752..0b8ff006d22 100644 --- a/spec/config/mail_room_spec.rb +++ b/spec/config/mail_room_spec.rb @@ -8,7 +8,7 @@ describe 'mail_room.yml' do context 'when incoming email is disabled' do before do - ENV['MAIL_ROOM_GITLAB_CONFIG_FILE'] = Rails.root.join('spec/fixtures/mail_room_disabled.yml').to_s + ENV['MAIL_ROOM_GITLAB_CONFIG_FILE'] = Rails.root.join('spec/fixtures/config/mail_room_disabled.yml').to_s Gitlab::MailRoom.reset_config! end @@ -26,7 +26,7 @@ describe 'mail_room.yml' do let(:gitlab_redis) { Gitlab::Redis.new(Rails.env) } before do - ENV['MAIL_ROOM_GITLAB_CONFIG_FILE'] = Rails.root.join('spec/fixtures/mail_room_enabled.yml').to_s + ENV['MAIL_ROOM_GITLAB_CONFIG_FILE'] = Rails.root.join('spec/fixtures/config/mail_room_enabled.yml').to_s Gitlab::MailRoom.reset_config! end diff --git a/spec/fixtures/mail_room_disabled.yml b/spec/fixtures/config/mail_room_disabled.yml similarity index 100% rename from spec/fixtures/mail_room_disabled.yml rename to spec/fixtures/config/mail_room_disabled.yml diff --git a/spec/fixtures/mail_room_enabled.yml b/spec/fixtures/config/mail_room_enabled.yml similarity index 100% rename from spec/fixtures/mail_room_enabled.yml rename to spec/fixtures/config/mail_room_enabled.yml