Skip to content

Commit

Permalink
fix fmt errors
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelbadawi committed Oct 2, 2024
1 parent dded23b commit 5226f80
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions crates/handlers/src/compat/login.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,9 @@ pub async fn start_new_session(
repo.user().acquire_lock_for_sync(&user).await?;

// Now that the user credentials have been verified, start a new compat session
let device = if let Some(id) = device_id { Device::try_from(id).map_err(RouteError::InvalidDeviceID)? } else {
let device = if let Some(id) = device_id {
Device::try_from(id).map_err(RouteError::InvalidDeviceID)?
} else {
// Generate a new device ID only if not provided
let device: Device = Device::generate(rng);
device
Expand All @@ -329,8 +331,7 @@ pub async fn start_new_session(
let existing_sessions = repo.compat_session().list(filter, pagination).await?;

let session: CompatSession = if existing_sessions.edges.is_empty() {
repo
.compat_session()
repo.compat_session()
.add(rng, clock, &user, device, None, false)
.await?
} else {
Expand Down Expand Up @@ -384,15 +385,11 @@ pub(crate) async fn post(
user
} else {
// User not found while existing in the provider: create it
let new_user =
repo.user().add(&mut rng, &clock, username.clone()).await?;
let new_user = repo.user().add(&mut rng, &clock, username.clone()).await?;

// Replicate in Synapse
homeserver
.provision_user(&ProvisionRequest::new(
mxid.clone(),
username.clone(),
))
.provision_user(&ProvisionRequest::new(mxid.clone(), username.clone()))
.await
.unwrap();

Expand Down

0 comments on commit 5226f80

Please sign in to comment.