summaryrefslogtreecommitdiffstats
path: root/api4/context.go
diff options
context:
space:
mode:
authorHarrison Healey <harrisonmhealey@gmail.com>2017-04-04 11:54:52 -0400
committerJoram Wilander <jwawilander@gmail.com>2017-04-04 11:54:52 -0400
commitc7bdce8a6641ed8d361a43b6004a351535c78423 (patch)
treef42d32d8a4d0cd4f702644dcb6a594f905f3f771 /api4/context.go
parent3a79e451ffe3ffe618311ee15b02dbebde6a77b0 (diff)
downloadchat-c7bdce8a6641ed8d361a43b6004a351535c78423.tar.gz
chat-c7bdce8a6641ed8d361a43b6004a351535c78423.tar.bz2
chat-c7bdce8a6641ed8d361a43b6004a351535c78423.zip
PLT-5900 Removed automatic configuration of SiteURL (#5952)
* Revert "PLT-5765 Passed SiteURL to SendNotifications (#5705)" This reverts commit a8e68bd8905972ae59de90fa33d5b3e3c274dc47. * Removed automatic configuration of SiteURL * Reverted unintentional config changes * Updated help text * Added link to docs in Site URL warning * Fixed merge conflict
Diffstat (limited to 'api4/context.go')
-rw-r--r--api4/context.go31
1 files changed, 13 insertions, 18 deletions
diff --git a/api4/context.go b/api4/context.go
index 8f663431d..36a48eb9d 100644
--- a/api4/context.go
+++ b/api4/context.go
@@ -19,14 +19,14 @@ import (
)
type Context struct {
- Session model.Session
- Params *ApiParams
- Err *model.AppError
- T goi18n.TranslateFunc
- RequestId string
- IpAddress string
- Path string
- siteURL string
+ Session model.Session
+ Params *ApiParams
+ Err *model.AppError
+ T goi18n.TranslateFunc
+ RequestId string
+ IpAddress string
+ Path string
+ siteURLHeader string
}
func ApiHandler(h func(*Context, http.ResponseWriter, *http.Request)) http.Handler {
@@ -125,12 +125,7 @@ func (h handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
isTokenFromQueryString = true
}
- if utils.GetSiteURL() == "" {
- protocol := app.GetProtocol(r)
- c.SetSiteURL(protocol + "://" + r.Host)
- } else {
- c.SetSiteURL(utils.GetSiteURL())
- }
+ c.SetSiteURLHeader(app.GetProtocol(r) + "://" + r.Host)
w.Header().Set(model.HEADER_REQUEST_ID, c.RequestId)
w.Header().Set(model.HEADER_VERSION_ID, fmt.Sprintf("%v.%v.%v.%v", model.CurrentVersion, model.BuildNumber, utils.CfgHash, utils.IsLicensed))
@@ -320,12 +315,12 @@ func (c *Context) SetPermissionError(permission *model.Permission) {
c.Err.StatusCode = http.StatusForbidden
}
-func (c *Context) SetSiteURL(url string) {
- c.siteURL = strings.TrimRight(url, "/")
+func (c *Context) SetSiteURLHeader(url string) {
+ c.siteURLHeader = strings.TrimRight(url, "/")
}
-func (c *Context) GetSiteURL() string {
- return c.siteURL
+func (c *Context) GetSiteURLHeader() string {
+ return c.siteURLHeader
}
func (c *Context) RequireUserId() *Context {