[MM-63774] Allow users to leave private channels when there is only 1 member (#30746)
* allow last user to leave private channel --------- Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
@@ -897,6 +897,17 @@ func TestLeaveChannel(t *testing.T) {
|
||||
require.Nil(t, appErr)
|
||||
require.Len(t, threads.Threads, 1)
|
||||
})
|
||||
|
||||
t.Run("can leave private channel as last member", func(t *testing.T) {
|
||||
channel := th.createChannel(th.Context, th.BasicTeam, model.ChannelTypePrivate)
|
||||
|
||||
count, appErr := th.App.GetChannelMemberCount(th.Context, th.BasicChannel.Id)
|
||||
require.Nil(t, appErr, "It should remove channel membership")
|
||||
require.Equal(t, int64(1), count)
|
||||
|
||||
appErr = th.App.LeaveChannel(th.Context, channel.Id, th.BasicUser.Id)
|
||||
require.Nil(t, appErr)
|
||||
})
|
||||
}
|
||||
|
||||
func TestLeaveLastChannel(t *testing.T) {
|
||||
|
||||
Ссылка в новой задаче
Block a user