Merge branch '244-room-history'
commit
8f1d8eeca2
|
@ -7,11 +7,13 @@ use ruma::{
|
|||
membership::{get_member_events, join_room_by_id, leave_room},
|
||||
message::get_message_events,
|
||||
},
|
||||
events::room::history_visibility::HistoryVisibility,
|
||||
UserId,
|
||||
};
|
||||
|
||||
use crate::{
|
||||
media::{MediaFormat, MediaRequest, MediaType},
|
||||
room::RoomType,
|
||||
BaseRoom, Client, Result, RoomMember,
|
||||
};
|
||||
|
||||
|
@ -169,6 +171,10 @@ impl Common {
|
|||
}
|
||||
|
||||
async fn ensure_members(&self) -> Result<()> {
|
||||
if !self.are_events_visible() {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
if !self.are_members_synced() {
|
||||
self.request_members().await?;
|
||||
}
|
||||
|
@ -176,6 +182,17 @@ impl Common {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn are_events_visible(&self) -> bool {
|
||||
if let RoomType::Invited = self.inner.room_type() {
|
||||
return matches!(
|
||||
self.inner.history_visibility(),
|
||||
HistoryVisibility::WorldReadable | HistoryVisibility::Invited
|
||||
);
|
||||
}
|
||||
|
||||
true
|
||||
}
|
||||
|
||||
/// Sync the member list with the server.
|
||||
///
|
||||
/// This method will de-duplicate requests if it is called multiple times in
|
||||
|
|
Loading…
Reference in New Issue