[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>
Этот коммит содержится в:
Ben Cooke
2025-05-14 16:58:13 +01:00
коммит произвёл GitHub
родитель 9fe678cad3
Коммит 6b4ab0a891
3 изменённых файлов: 11 добавлений и 21 удалений

Просмотреть файл

@@ -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) {