merging files
Этот коммит содержится в:
@@ -201,21 +201,23 @@ func TestLoadTestUrlCommands(t *testing.T) {
|
||||
t.Fatal("/loadtest url for README.md should've executed")
|
||||
}
|
||||
|
||||
command = "/loadtest url test-emoticons1.md"
|
||||
if r := Client.Must(Client.Command(channel.Id, command, false)).Data.(*model.CommandResponse); r.Text != "Loading data..." {
|
||||
t.Fatal("/loadtest url for test-emoticons.md should've executed")
|
||||
}
|
||||
// Removing these tests since they break compatibilty with previous release branches because the url pulls from github master
|
||||
|
||||
command = "/loadtest url test-emoticons1"
|
||||
if r := Client.Must(Client.Command(channel.Id, command, false)).Data.(*model.CommandResponse); r.Text != "Loading data..." {
|
||||
t.Fatal("/loadtest url for test-emoticons should've executed")
|
||||
}
|
||||
// command = "/loadtest url test-emoticons1.md"
|
||||
// if r := Client.Must(Client.Command(channel.Id, command, false)).Data.(*model.CommandResponse); r.Text != "Loading data..." {
|
||||
// t.Fatal("/loadtest url for test-emoticons.md should've executed")
|
||||
// }
|
||||
|
||||
posts := Client.Must(Client.GetPosts(channel.Id, 0, 5, "")).Data.(*model.PostList)
|
||||
// note that this may make more than 3 posts if files are too long to fit in an individual post
|
||||
if len(posts.Order) < 3 {
|
||||
t.Fatal("/loadtest url made too few posts, perhaps there needs to be a delay before GetPosts in the test?")
|
||||
}
|
||||
// command = "/loadtest url test-emoticons1"
|
||||
// if r := Client.Must(Client.Command(channel.Id, command, false)).Data.(*model.CommandResponse); r.Text != "Loading data..." {
|
||||
// t.Fatal("/loadtest url for test-emoticons should've executed")
|
||||
// }
|
||||
|
||||
// posts := Client.Must(Client.GetPosts(channel.Id, 0, 5, "")).Data.(*model.PostList)
|
||||
// // note that this may make more than 3 posts if files are too long to fit in an individual post
|
||||
// if len(posts.Order) < 3 {
|
||||
// t.Fatal("/loadtest url made too few posts, perhaps there needs to be a delay before GetPosts in the test?")
|
||||
// }
|
||||
|
||||
time.Sleep(2 * time.Second)
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ func TestUploadFile(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
path := utils.FindDir("web/static/images")
|
||||
path := utils.FindDir("tests")
|
||||
file, err := os.Open(path + "/test.png")
|
||||
defer file.Close()
|
||||
|
||||
@@ -159,7 +159,7 @@ func TestGetFile(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
path := utils.FindDir("web/static/images")
|
||||
path := utils.FindDir("tests")
|
||||
file, err := os.Open(path + "/test.png")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -342,7 +342,7 @@ func TestGetPublicLink(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
path := utils.FindDir("web/static/images")
|
||||
path := utils.FindDir("tests")
|
||||
file, err := os.Open(path + "/test.png")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
||||
14
api/user.go
14
api/user.go
@@ -249,7 +249,7 @@ func CreateUser(team *model.Team, user *model.User) (*model.User, *model.AppErro
|
||||
}
|
||||
}
|
||||
|
||||
func CreateOAuthUser(c *Context, w http.ResponseWriter, r *http.Request, service string, userData io.ReadCloser, team *model.Team) *model.User {
|
||||
func CreateOAuthUser(c *Context, w http.ResponseWriter, r *http.Request, service string, userData io.Reader, team *model.Team) *model.User {
|
||||
var user *model.User
|
||||
provider := einterfaces.GetOauthProvider(service)
|
||||
if provider == nil {
|
||||
@@ -481,7 +481,10 @@ func LoginByUsername(c *Context, w http.ResponseWriter, r *http.Request, usernam
|
||||
return nil
|
||||
}
|
||||
|
||||
func LoginByOAuth(c *Context, w http.ResponseWriter, r *http.Request, service string, userData io.ReadCloser, team *model.Team) *model.User {
|
||||
func LoginByOAuth(c *Context, w http.ResponseWriter, r *http.Request, service string, userData io.Reader, team *model.Team) *model.User {
|
||||
buf := bytes.Buffer{}
|
||||
buf.ReadFrom(userData)
|
||||
|
||||
authData := ""
|
||||
provider := einterfaces.GetOauthProvider(service)
|
||||
if provider == nil {
|
||||
@@ -489,7 +492,7 @@ func LoginByOAuth(c *Context, w http.ResponseWriter, r *http.Request, service st
|
||||
map[string]interface{}{"Service": service}, "")
|
||||
return nil
|
||||
} else {
|
||||
authData = provider.GetAuthDataFromJson(userData)
|
||||
authData = provider.GetAuthDataFromJson(bytes.NewReader(buf.Bytes()))
|
||||
}
|
||||
|
||||
if len(authData) == 0 {
|
||||
@@ -500,6 +503,9 @@ func LoginByOAuth(c *Context, w http.ResponseWriter, r *http.Request, service st
|
||||
|
||||
var user *model.User
|
||||
if result := <-Srv.Store.User().GetByAuth(team.Id, authData, service); result.Err != nil {
|
||||
if result.Err.Id == store.MISSING_AUTH_ACCOUNT_ERROR && team.AllowOpenInvite {
|
||||
return CreateOAuthUser(c, w, r, service, bytes.NewReader(buf.Bytes()), team)
|
||||
}
|
||||
c.Err = result.Err
|
||||
return nil
|
||||
} else {
|
||||
@@ -1049,7 +1055,7 @@ func createProfileImage(username string, userId string) ([]byte, *model.AppError
|
||||
|
||||
initial := string(strings.ToUpper(username)[0])
|
||||
|
||||
fontBytes, err := ioutil.ReadFile(utils.FindDir("web/static/fonts") + utils.Cfg.FileSettings.InitialFont)
|
||||
fontBytes, err := ioutil.ReadFile(utils.FindDir("fonts") + utils.Cfg.FileSettings.InitialFont)
|
||||
if err != nil {
|
||||
return nil, model.NewLocAppError("createProfileImage", "api.user.create_profile_image.default_font.app_error", nil, err.Error())
|
||||
}
|
||||
|
||||
@@ -470,7 +470,7 @@ func TestUserUploadProfileImage(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
path := utils.FindDir("web/static/images")
|
||||
path := utils.FindDir("tests")
|
||||
file, err := os.Open(path + "/test.png")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
||||
Ссылка в новой задаче
Block a user