Commit 51f174b97f686397bc7299c16a64fda14d5bc718

Authored by Dmitriy Zaporozhets
1 parent 00ef16a6

fix port issue

app/mailers/notify.rb
@@ -4,7 +4,7 @@ class Notify < ActionMailer::Base @@ -4,7 +4,7 @@ class Notify < ActionMailer::Base
4 4
5 default_url_options[:host] = Gitlab.config.web_host 5 default_url_options[:host] = Gitlab.config.web_host
6 default_url_options[:protocol] = Gitlab.config.web_protocol 6 default_url_options[:protocol] = Gitlab.config.web_protocol
7 - default_url_options[:port] = Gitlab.config.web_port 7 + default_url_options[:port] = Gitlab.config.web_port if Gitlab.config.web_custom_port?
8 8
9 default from: Gitlab.config.email_from 9 default from: Gitlab.config.email_from
10 10
config/initializers/1_settings.rb
@@ -20,17 +20,25 @@ class Settings < Settingslogic @@ -20,17 +20,25 @@ class Settings < Settingslogic
20 20
21 def web_port 21 def web_port
22 if web.https 22 if web.https
23 - nil 23 + web['port'] = 443
24 else 24 else
25 web['port'] ||= 80 25 web['port'] ||= 80
26 - end 26 + end.to_i
  27 + end
  28 +
  29 + def web_custom_port?
  30 + ![443, 80].include?(web_port)
27 end 31 end
28 32
29 def build_url 33 def build_url
30 raw_url = self.web_protocol 34 raw_url = self.web_protocol
31 raw_url << "://" 35 raw_url << "://"
32 raw_url << web_host 36 raw_url << web_host
33 - raw_url << ":#{web_port}" if web_port.to_i != 80 37 +
  38 + if web_custom_port?
  39 + raw_url << ":#{web_port}"
  40 + end
  41 +
34 raw_url 42 raw_url
35 end 43 end
36 44