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?; .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 let collaborators = self
.get_channel_buffer_collaborators_internal(channel_id, &*tx) .get_channel_buffer_collaborators_internal(channel_id, &*tx)
.await?; .await?;

View file

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

View file

@ -180,7 +180,9 @@ impl Database {
) )
.await?; .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)); channel_members.retain(|member| !participant_user_ids.contains(member));
Ok(( Ok((

View file

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

View file

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

View file

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