From c8d7d80eb24acf2a62304a87b3e08b7cd2a2f86f Mon Sep 17 00:00:00 2001 From: Devin Ragotzy Date: Thu, 30 Jul 2020 07:50:09 -0400 Subject: [PATCH] Fix start/end token swap left from dropped commits --- src/client_server.rs | 4 ++-- src/database/rooms.rs | 10 +++------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/client_server.rs b/src/client_server.rs index aad0b637..cf3f67ca 100644 --- a/src/client_server.rs +++ b/src/client_server.rs @@ -3243,8 +3243,8 @@ pub fn get_message_events_route( .collect::>(); Ok(get_message_events::Response { - start: start_token, - end: Some(body.from.clone()), + start: Some(body.from.clone()), + end: start_token, chunk: events_before, state: Vec::new(), } diff --git a/src/database/rooms.rs b/src/database/rooms.rs index c44eb5a5..5c17f27e 100644 --- a/src/database/rooms.rs +++ b/src/database/rooms.rs @@ -596,14 +596,10 @@ impl Rooms { EventType::RoomMember => { if let Some(state_key) = state_key { // if the state_key fails - let target_user_id = UserId::try_from(state_key).map_err(|_| { - Error::BadRequest( - ErrorKind::InvalidParam, - "State key of member event does not contain user id.", - ) - })?; + let target_user_id = UserId::try_from(state_key) + .expect("This state_key was previously validated"); // Update our membership info, we do this here incase a user is invited - // and imediatly leaves we need the DB to record the invite event for auth + // and immediately leaves we need the DB to record the invite event for auth self.update_membership( &room_id, &target_user_id,