[MM-27376] api4/channel: add move channel to local mode (#15200)
* api4/channel: add move channel to local mode * app/channel: reflect review comments
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
d906be1d6c
Коммит
3f19a8c011
@@ -3932,35 +3932,35 @@ func TestMoveChannel(t *testing.T) {
|
||||
CheckErrorMessage(t, resp, "api.context.permissions.app_error")
|
||||
})
|
||||
|
||||
t.Run("Should fail to move channel due to a member not member of target team", func(t *testing.T) {
|
||||
th.TestForSystemAdminAndLocal(t, func(t *testing.T, client *model.Client4) {
|
||||
publicChannel := th.CreatePublicChannel()
|
||||
user := th.BasicUser
|
||||
|
||||
_, resp := th.SystemAdminClient.RemoveTeamMember(team2.Id, user.Id)
|
||||
_, resp := client.RemoveTeamMember(team2.Id, user.Id)
|
||||
CheckNoError(t, resp)
|
||||
|
||||
_, resp = th.SystemAdminClient.AddChannelMember(publicChannel.Id, user.Id)
|
||||
_, resp = client.AddChannelMember(publicChannel.Id, user.Id)
|
||||
CheckNoError(t, resp)
|
||||
|
||||
_, resp = th.SystemAdminClient.MoveChannel(publicChannel.Id, team2.Id, false)
|
||||
_, resp = client.MoveChannel(publicChannel.Id, team2.Id, false)
|
||||
require.NotNil(t, resp.Error)
|
||||
CheckErrorMessage(t, resp, "app.channel.move_channel.members_do_not_match.error")
|
||||
})
|
||||
}, "Should fail to move channel due to a member not member of target team")
|
||||
|
||||
t.Run("Should be able to (force) move channel by a member that is not member of target team", func(t *testing.T) {
|
||||
th.TestForSystemAdminAndLocal(t, func(t *testing.T, client *model.Client4) {
|
||||
publicChannel := th.CreatePublicChannel()
|
||||
user := th.BasicUser
|
||||
|
||||
_, resp := th.SystemAdminClient.RemoveTeamMember(team2.Id, user.Id)
|
||||
_, resp := client.RemoveTeamMember(team2.Id, user.Id)
|
||||
CheckNoError(t, resp)
|
||||
|
||||
_, resp = th.SystemAdminClient.AddChannelMember(publicChannel.Id, user.Id)
|
||||
_, resp = client.AddChannelMember(publicChannel.Id, user.Id)
|
||||
CheckNoError(t, resp)
|
||||
|
||||
newChannel, resp := th.SystemAdminClient.MoveChannel(publicChannel.Id, team2.Id, true)
|
||||
newChannel, resp := client.MoveChannel(publicChannel.Id, team2.Id, true)
|
||||
require.Nil(t, resp.Error)
|
||||
require.Equal(t, team2.Id, newChannel.TeamId)
|
||||
})
|
||||
}, "Should be able to (force) move channel by a member that is not member of target team")
|
||||
}
|
||||
|
||||
func TestUpdateCategoryForTeamForUser(t *testing.T) {
|
||||
|
||||
Ссылка в новой задаче
Block a user