Only allow Manage Members on root channels

This commit is contained in:
Conrad Irwin 2024-01-26 09:40:41 -07:00
parent abdf302367
commit c6d33d4bb9
6 changed files with 150 additions and 31 deletions

View file

@ -190,7 +190,9 @@ impl Database {
let parent = self.get_channel_internal(parent_id, &*tx).await?;
if parent.visibility != ChannelVisibility::Public {
Err(anyhow!("public channels must descend from public channels"))?;
Err(ErrorCode::BadPublicNesting
.with_tag("direction", "parent")
.anyhow())?;
}
}
} else if visibility == ChannelVisibility::Members {
@ -202,7 +204,9 @@ impl Database {
channel.id != channel_id && channel.visibility == ChannelVisibility::Public
})
{
Err(anyhow!("cannot make a parent of a public channel private"))?;
Err(ErrorCode::BadPublicNesting
.with_tag("direction", "children")
.anyhow())?;
}
}