Allow people to leave channels

Co-Authored-By: Max <max@zed.dev>
This commit is contained in:
Conrad Irwin 2024-01-26 11:38:13 -07:00
parent 8bc105ca1d
commit fd5994bc0a
5 changed files with 71 additions and 5 deletions

View file

@ -473,8 +473,11 @@ impl Database {
) -> Result<RemoveChannelMemberResult> {
self.transaction(|tx| async move {
let channel = self.get_channel_internal(channel_id, &*tx).await?;
self.check_user_is_channel_admin(&channel, admin_id, &*tx)
.await?;
if member_id != admin_id {
self.check_user_is_channel_admin(&channel, admin_id, &*tx)
.await?;
}
let result = channel_member::Entity::delete_many()
.filter(