PLT-5900 Removed automatic configuration of SiteURL (#5952)

* Revert "PLT-5765 Passed SiteURL to SendNotifications (#5705)"

This reverts commit a8e68bd890.

* Removed automatic configuration of SiteURL

* Reverted unintentional config changes

* Updated help text

* Added link to docs in Site URL warning

* Fixed merge conflict
Этот коммит содержится в:
Harrison Healey
2017-04-04 11:54:52 -04:00
коммит произвёл Joram Wilander
родитель 3a79e451ff
Коммит c7bdce8a66
49 изменённых файлов: 336 добавлений и 268 удалений

Просмотреть файл

@@ -26,7 +26,7 @@ type Context struct {
IpAddress string
Path string
Err *model.AppError
siteURL string
siteURLHeader string
teamURLValid bool
teamURL string
T goi18n.TranslateFunc
@@ -146,12 +146,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))
@@ -191,11 +186,11 @@ func (h handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
}
if h.isApi || h.isTeamIndependent {
c.setTeamURL(c.GetSiteURL(), false)
c.setTeamURL(c.GetSiteURLHeader(), false)
c.Path = r.URL.Path
} else {
splitURL := strings.Split(r.URL.Path, "/")
c.setTeamURL(c.GetSiteURL()+"/"+splitURL[1], true)
c.setTeamURL(c.GetSiteURLHeader()+"/"+splitURL[1], true)
c.Path = "/" + strings.Join(splitURL[2:], "/")
}
@@ -391,16 +386,17 @@ func (c *Context) setTeamURL(url string, valid bool) {
func (c *Context) SetTeamURLFromSession() {
if result := <-app.Srv.Store.Team().Get(c.TeamId); result.Err == nil {
c.setTeamURL(c.GetSiteURL()+"/"+result.Data.(*model.Team).Name, true)
c.setTeamURL(c.GetSiteURLHeader()+"/"+result.Data.(*model.Team).Name, true)
}
}
func (c *Context) SetSiteURL(url string) {
c.siteURL = strings.TrimRight(url, "/")
func (c *Context) SetSiteURLHeader(url string) {
c.siteURLHeader = strings.TrimRight(url, "/")
}
// TODO see where these are used
func (c *Context) GetTeamURLFromTeam(team *model.Team) string {
return c.GetSiteURL() + "/" + team.Name
return c.GetSiteURLHeader() + "/" + team.Name
}
func (c *Context) GetTeamURL() string {
@@ -413,8 +409,8 @@ func (c *Context) GetTeamURL() string {
return c.teamURL
}
func (c *Context) GetSiteURL() string {
return c.siteURL
func (c *Context) GetSiteURLHeader() string {
return c.siteURLHeader
}
func (c *Context) GetCurrentTeamMember() *model.TeamMember {