Merge pull request #370 from hmhealey/mm1812

MM-1812 Provide warnings on team invite screens when email is disabled
Этот коммит содержится в:
Christopher Speller
2015-08-14 08:48:24 -04:00
родитель a8930cbabe 8fc4456213
Коммит 92c4df5b10
10 изменённых файлов: 546 добавлений и 292 удалений

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

@@ -40,6 +40,7 @@ func InitApi() {
InitWebSocket(r)
InitFile(r)
InitCommand(r)
InitConfig(r)
templatesDir := utils.FindDir("api/templates")
l4g.Debug("Parsing server templates at %v", templatesDir)

34
api/config.go Обычный файл
Просмотреть файл

@@ -0,0 +1,34 @@
// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved.
// See License.txt for license information.
package api
import (
l4g "code.google.com/p/log4go"
"encoding/json"
"github.com/gorilla/mux"
"github.com/mattermost/platform/model"
"github.com/mattermost/platform/utils"
"net/http"
"strconv"
)
func InitConfig(r *mux.Router) {
l4g.Debug("Initializing config api routes")
sr := r.PathPrefix("/config").Subrouter()
sr.Handle("/get_all", ApiAppHandler(getConfig)).Methods("GET")
}
func getConfig(c *Context, w http.ResponseWriter, r *http.Request) {
settings := make(map[string]string)
settings["ByPassEmail"] = strconv.FormatBool(utils.Cfg.EmailSettings.ByPassEmail)
if bytes, err := json.Marshal(settings); err != nil {
c.Err = model.NewAppError("getConfig", "Unable to marshall configuration data", err.Error())
return
} else {
w.Write(bytes)
}
}