[MM-53057] Disallow malformed channel names for DMs (#24404)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
24f5672da8
Коммит
5d3ba7483b
@@ -196,7 +196,7 @@ func TestSearchFileInfoStore(t *testing.T, s store.Store, testEngine *SearchTest
|
||||
}
|
||||
|
||||
func testFileInfoSearchFileInfosIncludingDMs(t *testing.T, th *SearchTestHelper) {
|
||||
direct, err := th.createDirectChannel(th.Team.Id, "direct-"+th.Team.Id, "direct-"+th.Team.Id, []*model.User{th.User, th.User2})
|
||||
direct, err := th.createDirectChannel(th.Team.Id, "direct-"+th.Team.Id, []*model.User{th.User, th.User2})
|
||||
require.NoError(t, err)
|
||||
defer th.deleteChannel(direct)
|
||||
|
||||
@@ -237,7 +237,7 @@ func testFileInfoSearchFileInfosIncludingDMs(t *testing.T, th *SearchTestHelper)
|
||||
}
|
||||
|
||||
func testFileInfoSearchFileInfosWithPagination(t *testing.T, th *SearchTestHelper) {
|
||||
direct, err := th.createDirectChannel(th.Team.Id, "direct", "direct", []*model.User{th.User, th.User2})
|
||||
direct, err := th.createDirectChannel(th.Team.Id, "direct", []*model.User{th.User, th.User2})
|
||||
require.NoError(t, err)
|
||||
defer th.deleteChannel(direct)
|
||||
|
||||
@@ -651,7 +651,7 @@ func testFileInfoSearchOrExcludeFileInfosInChannel(t *testing.T, th *SearchTestH
|
||||
}
|
||||
|
||||
func testFileInfoSearchOrExcludeFileInfosInDMGM(t *testing.T, th *SearchTestHelper) {
|
||||
direct, err := th.createDirectChannel(th.Team.Id, "direct", "direct", []*model.User{th.User, th.User2})
|
||||
direct, err := th.createDirectChannel(th.Team.Id, "direct", []*model.User{th.User, th.User2})
|
||||
require.NoError(t, err)
|
||||
defer th.deleteChannel(direct)
|
||||
|
||||
|
||||
@@ -275,10 +275,10 @@ func (th *SearchTestHelper) createChannel(teamID, name, displayName, purpose str
|
||||
return channel, nil
|
||||
}
|
||||
|
||||
func (th *SearchTestHelper) createDirectChannel(teamID, name, displayName string, users []*model.User) (*model.Channel, error) {
|
||||
func (th *SearchTestHelper) createDirectChannel(teamID, displayName string, users []*model.User) (*model.Channel, error) {
|
||||
channel := &model.Channel{
|
||||
TeamId: teamID,
|
||||
Name: name,
|
||||
Name: model.GetDMNameFromIds(users[0].Id, users[1].Id),
|
||||
DisplayName: displayName,
|
||||
Type: model.ChannelTypeDirect,
|
||||
}
|
||||
@@ -290,7 +290,7 @@ func (th *SearchTestHelper) createDirectChannel(teamID, name, displayName string
|
||||
|
||||
m2 := &model.ChannelMember{}
|
||||
m2.ChannelId = channel.Id
|
||||
m2.UserId = users[0].Id
|
||||
m2.UserId = users[1].Id
|
||||
m2.NotifyProps = model.GetDefaultChannelNotifyProps()
|
||||
|
||||
channel, err := th.Store.Channel().SaveDirectChannel(channel, m1, m2)
|
||||
|
||||
@@ -288,7 +288,7 @@ func TestSearchPostStore(t *testing.T, s store.Store, testEngine *SearchTestEngi
|
||||
}
|
||||
|
||||
func testSearchPostsIncludingDMs(t *testing.T, th *SearchTestHelper) {
|
||||
direct, err := th.createDirectChannel(th.Team.Id, "direct", "direct", []*model.User{th.User, th.User2})
|
||||
direct, err := th.createDirectChannel(th.Team.Id, "direct", []*model.User{th.User, th.User2})
|
||||
require.NoError(t, err)
|
||||
defer th.deleteChannel(direct)
|
||||
|
||||
@@ -310,7 +310,7 @@ func testSearchPostsIncludingDMs(t *testing.T, th *SearchTestHelper) {
|
||||
}
|
||||
|
||||
func testSearchPostsWithPagination(t *testing.T, th *SearchTestHelper) {
|
||||
direct, err := th.createDirectChannel(th.Team.Id, "direct", "direct", []*model.User{th.User, th.User2})
|
||||
direct, err := th.createDirectChannel(th.Team.Id, "direct", []*model.User{th.User, th.User2})
|
||||
require.NoError(t, err)
|
||||
defer th.deleteChannel(direct)
|
||||
|
||||
@@ -675,7 +675,7 @@ func testSearchOrExcludePostsInChannel(t *testing.T, th *SearchTestHelper) {
|
||||
}
|
||||
|
||||
func testSearchOrExcludePostsInDMGM(t *testing.T, th *SearchTestHelper) {
|
||||
direct, err := th.createDirectChannel(th.Team.Id, "direct", "direct", []*model.User{th.User, th.User2})
|
||||
direct, err := th.createDirectChannel(th.Team.Id, "direct", []*model.User{th.User, th.User2})
|
||||
require.NoError(t, err)
|
||||
defer th.deleteChannel(direct)
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user