Permalink
Browse files

fix port issue

  • Loading branch information...
1 parent 00ef16a commit 51f174b97f686397bc7299c16a64fda14d5bc718 @dzaporozhets dzaporozhets committed Jul 3, 2012
Showing with 12 additions and 4 deletions.
  1. +1 −1 app/mailers/notify.rb
  2. +11 −3 config/initializers/1_settings.rb
View
@@ -4,7 +4,7 @@ class Notify < ActionMailer::Base
default_url_options[:host] = Gitlab.config.web_host
default_url_options[:protocol] = Gitlab.config.web_protocol
- default_url_options[:port] = Gitlab.config.web_port
+ default_url_options[:port] = Gitlab.config.web_port if Gitlab.config.web_custom_port?
default from: Gitlab.config.email_from
@@ -20,17 +20,25 @@ def url
def web_port
if web.https
- nil
+ web['port'] = 443
else
web['port'] ||= 80
- end
+ end.to_i
+ end
+
+ def web_custom_port?
+ ![443, 80].include?(web_port)
end
def build_url
raw_url = self.web_protocol
raw_url << "://"
raw_url << web_host
- raw_url << ":#{web_port}" if web_port.to_i != 80
+
+ if web_custom_port?
+ raw_url << ":#{web_port}"
+ end
+
raw_url
end

0 comments on commit 51f174b

Please sign in to comment.