Rename members to participants in db crate

This commit is contained in:
Conrad Irwin 2023-10-12 20:42:42 -06:00
parent a7db2aa39d
commit da2b8082b3
6 changed files with 21 additions and 12 deletions

View file

@ -482,7 +482,9 @@ impl Database {
)
.await?;
channel_members = self.get_channel_members_internal(channel_id, &*tx).await?;
channel_members = self
.get_channel_participants_internal(channel_id, &*tx)
.await?;
let collaborators = self
.get_channel_buffer_collaborators_internal(channel_id, &*tx)
.await?;

View file

@ -498,7 +498,7 @@ impl Database {
}
pub async fn get_channel_members(&self, id: ChannelId) -> Result<Vec<UserId>> {
self.transaction(|tx| async move { self.get_channel_members_internal(id, &*tx).await })
self.transaction(|tx| async move { self.get_channel_participants_internal(id, &*tx).await })
.await
}
@ -536,7 +536,7 @@ impl Database {
.await
}
pub async fn get_channel_member_details(
pub async fn get_channel_participant_details(
&self,
channel_id: ChannelId,
user_id: UserId,
@ -616,7 +616,7 @@ impl Database {
.await
}
pub async fn get_channel_members_internal(
pub async fn get_channel_participants_internal(
&self,
id: ChannelId,
tx: &DatabaseTransaction,

View file

@ -180,7 +180,9 @@ impl Database {
)
.await?;
let mut channel_members = self.get_channel_members_internal(channel_id, &*tx).await?;
let mut channel_members = self
.get_channel_participants_internal(channel_id, &*tx)
.await?;
channel_members.retain(|member| !participant_user_ids.contains(member));
Ok((

View file

@ -53,7 +53,9 @@ impl Database {
let (channel_id, room) = self.get_channel_room(room_id, &tx).await?;
let channel_members;
if let Some(channel_id) = channel_id {
channel_members = self.get_channel_members_internal(channel_id, &tx).await?;
channel_members = self
.get_channel_participants_internal(channel_id, &tx)
.await?;
} else {
channel_members = Vec::new();
@ -377,7 +379,8 @@ impl Database {
let room = self.get_room(room_id, &tx).await?;
let channel_members = if let Some(channel_id) = channel_id {
self.get_channel_members_internal(channel_id, &tx).await?
self.get_channel_participants_internal(channel_id, &tx)
.await?
} else {
Vec::new()
};
@ -681,7 +684,8 @@ impl Database {
let (channel_id, room) = self.get_channel_room(room_id, &tx).await?;
let channel_members = if let Some(channel_id) = channel_id {
self.get_channel_members_internal(channel_id, &tx).await?
self.get_channel_participants_internal(channel_id, &tx)
.await?
} else {
Vec::new()
};
@ -839,7 +843,8 @@ impl Database {
};
let channel_members = if let Some(channel_id) = channel_id {
self.get_channel_members_internal(channel_id, &tx).await?
self.get_channel_participants_internal(channel_id, &tx)
.await?
} else {
Vec::new()
};

View file

@ -322,7 +322,7 @@ async fn test_channel_invites(db: &Arc<Database>) {
assert_eq!(user_3_invites, &[channel_1_1]);
let members = db
.get_channel_member_details(channel_1_1, user_1)
.get_channel_participant_details(channel_1_1, user_1)
.await
.unwrap();
assert_eq!(
@ -356,7 +356,7 @@ async fn test_channel_invites(db: &Arc<Database>) {
.unwrap();
let members = db
.get_channel_member_details(channel_1_3, user_1)
.get_channel_participant_details(channel_1_3, user_1)
.await
.unwrap();
assert_eq!(

View file

@ -2557,7 +2557,7 @@ async fn get_channel_members(
let db = session.db().await;
let channel_id = ChannelId::from_proto(request.channel_id);
let members = db
.get_channel_member_details(channel_id, session.user_id)
.get_channel_participant_details(channel_id, session.user_id)
.await?;
response.send(proto::GetChannelMembersResponse { members })?;
Ok(())