Skip to content

Commit

Permalink
[identity] Update V1 logout to handle new flow users
Browse files Browse the repository at this point in the history
Summary:
Addresss [[ https://linear.app/comm/issue/ENG-9696/update-v1-logout-rpc-to-skip-reorder-in-new-login-flow | ENG-9696 ]].

We want V1 logout to still work for new flows, but with two things:
- Don't update device list server side
- Inform the client that it should use new flows (it already handles the use_new_flow response)

Depends on D14075

Test Plan:
- Register a user
- V1 logout - OK
- Log in again and sign the device list (e.g. perform QR login)
- V1 logout again - The `use_new_flow` is returned and a message is displayed on client

Reviewers: kamil, varun

Reviewed By: kamil

Subscribers: ashoat, tomek

Differential Revision: https://phab.comm.dev/D14076
  • Loading branch information
barthap committed Dec 6, 2024
1 parent d91394b commit 3121657
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion services/identity/src/grpc_services/authenticated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,21 @@ impl IdentityClientService for AuthenticatedService {
) -> Result<tonic::Response<Empty>, tonic::Status> {
let (user_id, device_id) = get_user_and_device_id(&request)?;

self.db_client.remove_device(&user_id, &device_id).await?;
let is_new_flow_user = self
.db_client
.get_user_login_flow(&user_id)
.await?
.is_signed_device_list_flow();

// don't update device list for new flow users
if is_new_flow_user {
self
.db_client
.remove_device_data(&user_id, &device_id)
.await?;
} else {
self.db_client.remove_device(&user_id, &device_id).await?;
}

self
.db_client
Expand Down Expand Up @@ -422,6 +436,13 @@ impl IdentityClientService for AuthenticatedService {
let blob_client = self.authenticated_blob_client().await?;
spawn_delete_devices_services_data_task(&blob_client, [device_id].into());

// for new flow users we should inform it that should use new flow
if is_new_flow_user {
return Err(tonic::Status::failed_precondition(
tonic_status_messages::USE_NEW_FLOW,
));
}

let response = Empty {};
Ok(Response::new(response))
}
Expand Down

0 comments on commit 3121657

Please sign in to comment.