[Git][noosfero/noosfero][master] 2 commits: Check request scheme before generate top url

Rodrigo Souto gitlab at mg.gitlab.com
Thu Aug 30 08:54:26 BRT 2018


Rodrigo Souto pushed to branch master at Noosfero / noosfero


Commits:
5a502901 by Iasmin Mendes at 2018-08-27T11:55:29Z
Check request scheme before generate top url

- - - - -
349e481d by Rodrigo Souto at 2018-08-30T11:54:07Z
Merge branch 'mendesiasmin/noosfero-request-scheme'

- - - - -


2 changed files:

- app/controllers/application_controller.rb
- app/models/environment.rb


Changes:

=====================================
app/controllers/application_controller.rb
=====================================
@@ -99,6 +99,11 @@ class ApplicationController < ActionController::Base
     end
   end
 
+  before_filter :set_request_scheme
+  def set_request_scheme
+   environment.request_scheme = request.scheme
+  end
+
   attr_reader :environment
 
   # declares that the given <tt>actions</tt> cannot be accessed by other HTTP


=====================================
app/models/environment.rb
=====================================
@@ -777,7 +777,10 @@ class Environment < ApplicationRecord
     { :controller => 'admin_panel', :action => 'index' }
   end
 
-  def top_url(scheme = 'http')
+  attr_accessor :request_scheme
+  def top_url(scheme = nil)
+    scheme ||= request_scheme ? request_scheme : 'http'
+
     url = scheme + '://'
     url << (Noosfero.url_options.key?(:host) ? Noosfero.url_options[:host] : default_hostname)
     url << ':' << Noosfero.url_options[:port].to_s if Noosfero.url_options.key?(:port)



View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/6a7de2d8288859715490197af533080e3ebe2da7...349e481de1ed1e4d17cf120a1cc8cba43a04e6f5

-- 
View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/6a7de2d8288859715490197af533080e3ebe2da7...349e481de1ed1e4d17cf120a1cc8cba43a04e6f5
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20180830/3c69c982/attachment-0001.html>


More information about the Noosfero-dev mailing list