mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Replace base_uri with base_path (#10879)
DEV: Replace instances of Discourse.base_uri with Discourse.base_path
This is clearer because the base_uri is actually just a path prefix. This continues the work started in 555f467.
This commit is contained in:
committed by
GitHub
parent
5e3130ac26
commit
721ee36425
@@ -380,10 +380,15 @@ module Discourse
|
||||
SiteSetting.force_hostname.presence || RailsMultisite::ConnectionManagement.current_hostname
|
||||
end
|
||||
|
||||
def self.base_uri(default_value = "")
|
||||
def self.base_path(default_value = "")
|
||||
ActionController::Base.config.relative_url_root.presence || default_value
|
||||
end
|
||||
|
||||
def self.base_uri(default_value = "")
|
||||
deprecate("Discourse.base_uri is deprecated, use Discourse.base_path instead")
|
||||
base_path(default_value)
|
||||
end
|
||||
|
||||
def self.base_protocol
|
||||
SiteSetting.force_https? ? "https" : "http"
|
||||
end
|
||||
@@ -401,7 +406,7 @@ module Discourse
|
||||
end
|
||||
|
||||
def self.base_url
|
||||
base_url_no_prefix + base_uri
|
||||
base_url_no_prefix + base_path
|
||||
end
|
||||
|
||||
def self.route_for(uri)
|
||||
@@ -415,8 +420,8 @@ module Discourse
|
||||
return unless uri
|
||||
|
||||
path = +(uri.path || "")
|
||||
if !uri.host || (uri.host == Discourse.current_hostname && path.start_with?(Discourse.base_uri))
|
||||
path.slice!(Discourse.base_uri)
|
||||
if !uri.host || (uri.host == Discourse.current_hostname && path.start_with?(Discourse.base_path))
|
||||
path.slice!(Discourse.base_path)
|
||||
return Rails.application.routes.recognize_path(path)
|
||||
end
|
||||
|
||||
@@ -426,7 +431,6 @@ module Discourse
|
||||
end
|
||||
|
||||
class << self
|
||||
alias_method :base_path, :base_uri
|
||||
alias_method :base_url_no_path, :base_url_no_prefix
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user