summaryrefslogtreecommitdiffstats
path: root/api4
diff options
context:
space:
mode:
authorHarrison Healey <harrisonmhealey@gmail.com>2017-06-28 07:56:29 -0400
committerJoram Wilander <jwawilander@gmail.com>2017-06-28 07:56:29 -0400
commitc66799a83943af0ae03b17b657936e5327c55550 (patch)
treeca1bf150190fa95f84d010a854937817a03f6129 /api4
parent4484c82b1becc2fe5ab7b6842b3419b16c523445 (diff)
downloadchat-c66799a83943af0ae03b17b657936e5327c55550.tar.gz
chat-c66799a83943af0ae03b17b657936e5327c55550.tar.bz2
chat-c66799a83943af0ae03b17b657936e5327c55550.zip
Fixed error information being obscured when joining teams with API v4 (#6751)
Diffstat (limited to 'api4')
-rw-r--r--api4/team.go6
-rw-r--r--api4/team_test.go7
-rw-r--r--api4/user_test.go4
3 files changed, 4 insertions, 13 deletions
diff --git a/api4/team.go b/api4/team.go
index 63089fdc5..1cbd89481 100644
--- a/api4/team.go
+++ b/api4/team.go
@@ -373,14 +373,8 @@ func addUserToTeamFromInvite(c *Context, w http.ResponseWriter, r *http.Request)
if len(hash) > 0 && len(data) > 0 {
member, err = app.AddTeamMemberByHash(c.Session.UserId, hash, data)
- if err != nil {
- err = model.NewAppError("addTeamMember", "api.team.add_user_to_team.invalid_data.app_error", nil, "", http.StatusBadRequest)
- }
} else if len(inviteId) > 0 {
member, err = app.AddTeamMemberByInviteId(inviteId, c.Session.UserId)
- if err != nil {
- err = model.NewAppError("addTeamMember", "api.team.add_user_to_team.invalid_invite_id.app_error", nil, "", http.StatusBadRequest)
- }
} else {
err = model.NewAppError("addTeamMember", "api.team.add_user_to_team.missing_parameter.app_error", nil, "", http.StatusBadRequest)
}
diff --git a/api4/team_test.go b/api4/team_test.go
index c5e08fe97..e62790173 100644
--- a/api4/team_test.go
+++ b/api4/team_test.go
@@ -781,7 +781,7 @@ func TestAddTeamMember(t *testing.T) {
tm, resp := Client.AddTeamMember(team.Id, otherUser.Id)
CheckForbiddenStatus(t, resp)
if resp.Error == nil {
- t.Fatalf("ERror is nhul")
+ t.Fatalf("Error is nhul")
}
Client.Logout()
@@ -971,14 +971,11 @@ func TestAddTeamMember(t *testing.T) {
}
tm, resp = Client.AddTeamMemberFromInvite("", "", "junk")
- CheckBadRequestStatus(t, resp)
+ CheckNotFoundStatus(t, resp)
if tm != nil {
t.Fatal("should have not returned team member")
}
-
- _, resp = Client.AddTeamMemberFromInvite("", "", "junk")
- CheckBadRequestStatus(t, resp)
}
func TestAddTeamMembers(t *testing.T) {
diff --git a/api4/user_test.go b/api4/user_test.go
index b3fd83760..1067ebaf6 100644
--- a/api4/user_test.go
+++ b/api4/user_test.go
@@ -261,7 +261,7 @@ func TestCreateUserWithInviteId(t *testing.T) {
inviteId := model.NewId()
_, resp := Client.CreateUserWithInviteId(&user, inviteId)
- CheckInternalErrorStatus(t, resp)
+ CheckNotFoundStatus(t, resp)
CheckErrorMessage(t, resp, "store.sql_team.get_by_invite_id.find.app_error")
})
@@ -283,7 +283,7 @@ func TestCreateUserWithInviteId(t *testing.T) {
CheckNoError(t, resp)
_, resp = Client.CreateUserWithInviteId(&user, inviteId)
- CheckInternalErrorStatus(t, resp)
+ CheckNotFoundStatus(t, resp)
CheckErrorMessage(t, resp, "store.sql_team.get_by_invite_id.find.app_error")
})