Cleanup related to context refactor (#9988)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
829f183bb0
Коммит
8429add371
@@ -22,6 +22,7 @@ import (
|
||||
"github.com/mattermost/mattermost-server/model"
|
||||
"github.com/mattermost/mattermost-server/store"
|
||||
"github.com/mattermost/mattermost-server/utils"
|
||||
"github.com/mattermost/mattermost-server/utils/fileutils"
|
||||
"github.com/mattermost/mattermost-server/web"
|
||||
"github.com/mattermost/mattermost-server/wsapi"
|
||||
|
||||
@@ -63,7 +64,7 @@ func UseTestStore(store store.Store) {
|
||||
func setupTestHelper(enterprise bool, updateConfig func(*model.Config)) *TestHelper {
|
||||
testStore.DropAllTables()
|
||||
|
||||
permConfig, err := os.Open(utils.FindConfigFile("config.json"))
|
||||
permConfig, err := os.Open(fileutils.FindConfigFile("config.json"))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -102,7 +103,7 @@ func setupTestHelper(enterprise bool, updateConfig func(*model.Config)) *TestHel
|
||||
if updateConfig != nil {
|
||||
th.App.UpdateConfig(updateConfig)
|
||||
}
|
||||
serverErr := th.App.StartServer()
|
||||
serverErr := th.Server.Start()
|
||||
if serverErr != nil {
|
||||
panic(serverErr)
|
||||
}
|
||||
|
||||
@@ -21,14 +21,14 @@ import (
|
||||
"github.com/mattermost/mattermost-server/app"
|
||||
"github.com/mattermost/mattermost-server/model"
|
||||
"github.com/mattermost/mattermost-server/store"
|
||||
"github.com/mattermost/mattermost-server/utils"
|
||||
"github.com/mattermost/mattermost-server/utils/fileutils"
|
||||
"github.com/mattermost/mattermost-server/utils/testutils"
|
||||
)
|
||||
|
||||
var testDir = ""
|
||||
|
||||
func init() {
|
||||
testDir, _ = utils.FindDir("tests")
|
||||
testDir, _ = fileutils.FindDir("tests")
|
||||
}
|
||||
|
||||
func checkCond(tb testing.TB, cond bool, text string) {
|
||||
|
||||
@@ -13,6 +13,7 @@ import (
|
||||
"github.com/mattermost/mattermost-server/mlog"
|
||||
"github.com/mattermost/mattermost-server/model"
|
||||
"github.com/mattermost/mattermost-server/utils"
|
||||
"github.com/mattermost/mattermost-server/utils/fileutils"
|
||||
)
|
||||
|
||||
func (api *API) InitOAuth() {
|
||||
@@ -392,7 +393,7 @@ func authorizeOAuthPage(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Type", "text/html; charset=utf-8")
|
||||
w.Header().Set("Cache-Control", "no-cache, max-age=31556926, public")
|
||||
|
||||
staticDir, _ := utils.FindDir(model.CLIENT_DIR)
|
||||
staticDir, _ := fileutils.FindDir(model.CLIENT_DIR)
|
||||
http.ServeFile(w, r, filepath.Join(staticDir, "root.html"))
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/mattermost/mattermost-server/model"
|
||||
"github.com/mattermost/mattermost-server/utils"
|
||||
"github.com/mattermost/mattermost-server/utils/fileutils"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
@@ -38,7 +38,7 @@ func TestPlugin(t *testing.T) {
|
||||
*cfg.PluginSettings.EnableUploads = true
|
||||
})
|
||||
|
||||
path, _ := utils.FindDir("tests")
|
||||
path, _ := fileutils.FindDir("tests")
|
||||
tarData, err := ioutil.ReadFile(filepath.Join(path, "testplugin.tar.gz"))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
||||
@@ -5,6 +5,7 @@ package api4
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
@@ -419,15 +420,18 @@ func getAnalytics(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func getSupportedTimezones(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
supportedTimezones := c.App.Timezones()
|
||||
|
||||
if supportedTimezones != nil {
|
||||
w.Write([]byte(model.TimezonesToJson(supportedTimezones)))
|
||||
return
|
||||
supportedTimezones := c.App.Timezones.GetSupported()
|
||||
if supportedTimezones == nil {
|
||||
supportedTimezones = make([]string, 0)
|
||||
}
|
||||
|
||||
emptyTimezones := make([]string, 0)
|
||||
w.Write([]byte(model.TimezonesToJson(emptyTimezones)))
|
||||
b, err := json.Marshal(supportedTimezones)
|
||||
if err != nil {
|
||||
c.Log.Warn("Unable to marshal JSON in timezones.", mlog.Err(err))
|
||||
w.WriteHeader(http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
w.Write(b)
|
||||
}
|
||||
|
||||
func testS3(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
@@ -723,7 +723,7 @@ func TestSupportedTimezones(t *testing.T) {
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
supportedTimezonesFromConfig := th.App.Timezones()
|
||||
supportedTimezonesFromConfig := th.App.Timezones.GetSupported()
|
||||
supportedTimezones, resp := Client.GetSupportedTimezone()
|
||||
|
||||
CheckNoError(t, resp)
|
||||
|
||||
Ссылка в новой задаче
Block a user