mirror of
https://github.com/zed-industries/zed.git
synced 2024-12-24 17:28:40 +00:00
Fix filtering when providing non-admins info about channel members
This commit is contained in:
parent
150ed641ae
commit
841cfac1f8
1 changed files with 12 additions and 6 deletions
|
@ -713,7 +713,7 @@ impl Database {
|
|||
user_id: UserId,
|
||||
) -> Result<Vec<proto::ChannelMember>> {
|
||||
self.transaction(|tx| async move {
|
||||
let role = self
|
||||
let user_role = self
|
||||
.check_user_is_channel_member(channel_id, user_id, &*tx)
|
||||
.await?;
|
||||
|
||||
|
@ -797,13 +797,19 @@ impl Database {
|
|||
|
||||
Ok(user_details
|
||||
.into_iter()
|
||||
.filter_map(|(user_id, details)| {
|
||||
// If the user is not an admin, don't give them all of the details
|
||||
if role != ChannelRole::Admin {
|
||||
if details.kind == Kind::AncestorMember {
|
||||
.filter_map(|(user_id, mut details)| {
|
||||
// If the user is not an admin, don't give them as much
|
||||
// information about the other members.
|
||||
if user_role != ChannelRole::Admin {
|
||||
if details.kind == Kind::Invitee
|
||||
|| details.channel_role == ChannelRole::Banned
|
||||
{
|
||||
return None;
|
||||
}
|
||||
return None;
|
||||
|
||||
if details.channel_role == ChannelRole::Admin {
|
||||
details.channel_role = ChannelRole::Member;
|
||||
}
|
||||
}
|
||||
|
||||
Some(proto::ChannelMember {
|
||||
|
|
Loading…
Reference in a new issue