PLT-6983 Allowed team invite IDs of arbitrary lengths to match API v3 (#6944)
Этот коммит содержится в:
коммит произвёл
Saturnino Abril
родитель
a20ddb4047
Коммит
9a23519d07
@@ -355,7 +355,7 @@ func (c *Context) RequireInviteId() *Context {
|
|||||||
return c
|
return c
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(c.Params.InviteId) != 26 {
|
if len(c.Params.InviteId) == 0 {
|
||||||
c.SetInvalidUrlParam("invite_id")
|
c.SetInvalidUrlParam("invite_id")
|
||||||
}
|
}
|
||||||
return c
|
return c
|
||||||
|
|||||||
@@ -12,10 +12,10 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"encoding/base64"
|
||||||
"github.com/mattermost/platform/app"
|
"github.com/mattermost/platform/app"
|
||||||
"github.com/mattermost/platform/model"
|
"github.com/mattermost/platform/model"
|
||||||
"github.com/mattermost/platform/utils"
|
"github.com/mattermost/platform/utils"
|
||||||
"encoding/base64"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestCreateTeam(t *testing.T) {
|
func TestCreateTeam(t *testing.T) {
|
||||||
@@ -1475,7 +1475,7 @@ func TestInviteUsersToTeam(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestGetTeamInviteInfo(t *testing.T) {
|
func TestGetTeamInviteInfo(t *testing.T) {
|
||||||
th := Setup().InitBasic()
|
th := Setup().InitBasic().InitSystemAdmin()
|
||||||
defer TearDown()
|
defer TearDown()
|
||||||
Client := th.Client
|
Client := th.Client
|
||||||
team := th.BasicTeam
|
team := th.BasicTeam
|
||||||
@@ -1491,6 +1491,13 @@ func TestGetTeamInviteInfo(t *testing.T) {
|
|||||||
t.Fatal("should be empty")
|
t.Fatal("should be empty")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
team.InviteId = "12345678901234567890123456789012"
|
||||||
|
team, resp = th.SystemAdminClient.UpdateTeam(team)
|
||||||
|
CheckNoError(t, resp)
|
||||||
|
|
||||||
|
team, resp = Client.GetTeamInviteInfo(team.InviteId)
|
||||||
|
CheckNoError(t, resp)
|
||||||
|
|
||||||
_, resp = Client.GetTeamInviteInfo("junk")
|
_, resp = Client.GetTeamInviteInfo("junk")
|
||||||
CheckBadRequestStatus(t, resp)
|
CheckNotFoundStatus(t, resp)
|
||||||
}
|
}
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user