[MM-18391] Removing convert channel endpoint (#18015)
* removing convert endpoint * fixing translations Co-authored-by: Benjamin Cooke <benjamincooke@Benjamins-MacBook-Pro.local>
Этот коммит содержится в:
@@ -1855,75 +1855,6 @@ func TestPermanentDeleteChannel(t *testing.T) {
|
||||
}, "Permanent deletion with EnableAPIChannelDeletion set")
|
||||
}
|
||||
|
||||
func TestConvertChannelToPrivate(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
|
||||
defaultChannel, _ := th.App.GetChannelByName(model.DefaultChannelName, th.BasicTeam.Id, false)
|
||||
_, resp, err := client.ConvertChannelToPrivate(defaultChannel.Id)
|
||||
require.Error(t, err)
|
||||
CheckForbiddenStatus(t, resp)
|
||||
|
||||
privateChannel := th.CreatePrivateChannel()
|
||||
_, resp, err = client.ConvertChannelToPrivate(privateChannel.Id)
|
||||
require.Error(t, err)
|
||||
CheckForbiddenStatus(t, resp)
|
||||
|
||||
publicChannel := th.CreatePublicChannel()
|
||||
_, resp, err = client.ConvertChannelToPrivate(publicChannel.Id)
|
||||
require.Error(t, err)
|
||||
CheckForbiddenStatus(t, resp)
|
||||
|
||||
th.LoginTeamAdmin()
|
||||
th.RemovePermissionFromRole(model.PermissionConvertPublicChannelToPrivate.Id, model.TeamAdminRoleId)
|
||||
|
||||
_, resp, err = client.ConvertChannelToPrivate(publicChannel.Id)
|
||||
require.Error(t, err)
|
||||
CheckForbiddenStatus(t, resp)
|
||||
|
||||
th.AddPermissionToRole(model.PermissionConvertPublicChannelToPrivate.Id, model.TeamAdminRoleId)
|
||||
|
||||
rchannel, resp, err := client.ConvertChannelToPrivate(publicChannel.Id)
|
||||
require.NoError(t, err)
|
||||
CheckOKStatus(t, resp)
|
||||
require.Equal(t, model.ChannelTypePrivate, rchannel.Type, "channel should be converted from public to private")
|
||||
|
||||
rchannel, resp, err = th.SystemAdminClient.ConvertChannelToPrivate(privateChannel.Id)
|
||||
require.Error(t, err)
|
||||
CheckBadRequestStatus(t, resp)
|
||||
require.Nil(t, rchannel, "should not return a channel")
|
||||
|
||||
rchannel, resp, err = th.SystemAdminClient.ConvertChannelToPrivate(defaultChannel.Id)
|
||||
require.Error(t, err)
|
||||
CheckBadRequestStatus(t, resp)
|
||||
require.Nil(t, rchannel, "should not return a channel")
|
||||
|
||||
WebSocketClient, err := th.CreateWebSocketClient()
|
||||
require.NoError(t, err)
|
||||
WebSocketClient.Listen()
|
||||
|
||||
publicChannel2 := th.CreatePublicChannel()
|
||||
rchannel, resp, err = th.SystemAdminClient.ConvertChannelToPrivate(publicChannel2.Id)
|
||||
require.NoError(t, err)
|
||||
CheckOKStatus(t, resp)
|
||||
require.Equal(t, model.ChannelTypePrivate, rchannel.Type, "channel should be converted from public to private")
|
||||
|
||||
timeout := time.After(10 * time.Second)
|
||||
|
||||
for {
|
||||
select {
|
||||
case resp := <-WebSocketClient.EventChannel:
|
||||
if resp.EventType() == model.WebsocketEventChannelConverted && resp.GetData()["channel_id"].(string) == publicChannel2.Id {
|
||||
return
|
||||
}
|
||||
case <-timeout:
|
||||
require.Fail(t, "timed out waiting for channel_converted event")
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestUpdateChannelPrivacy(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
Ссылка в новой задаче
Block a user