fix: room version warnings and other bugs when joining rooms

This commit is contained in:
Timo Kösters 2021-05-21 22:22:05 +02:00
parent 989d843c40
commit 3e2f742f30
No known key found for this signature in database
GPG key ID: 24DA7517711A2BA4
3 changed files with 12 additions and 44 deletions

View file

@ -103,11 +103,6 @@ pub async fn sync_events_route(
// The inner Option is None when there is an event, but there is no state hash associated
// with it. This can happen for the RoomCreate event, so all updates should arrive.
let first_pdu_before_since = db.rooms.pdus_until(sender_user, &room_id, since).next();
let pdus_after_since = db
.rooms
.pdus_after(sender_user, &room_id, since)
.next()
.is_some();
let since_shortstatehash = first_pdu_before_since.as_ref().map(|pdu| {
db.rooms
@ -121,7 +116,7 @@ pub async fn sync_events_route(
invited_member_count,
joined_since_last_sync,
state_events,
) = if pdus_after_since && Some(current_shortstatehash) != since_shortstatehash {
) = if Some(current_shortstatehash) != since_shortstatehash {
let current_state = db.rooms.room_state_full(&room_id)?;
let current_members = current_state
.iter()
@ -224,6 +219,7 @@ pub async fn sync_events_route(
device_list_updates.insert(user_id);
}
}
// TODO: Remove, this should never happen here, right?
(MembershipState::Join, MembershipState::Leave) => {
// Write down users that have left encrypted rooms we are in
left_encrypted_users.insert(user_id);