-
Notifications
You must be signed in to change notification settings - Fork 29
logout feature #432
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
logout feature #432
Conversation
Signed-off-by: Alvin <[email protected]>
Due to the age of PR #293 and substantial changes in the codebase, resolving merge conflicts became quite challenging. I've contacted the original author, Guocork, who also suggested creating a new PR. Therefore, I've created a fresh PR implementing the same functionality with updated code and comprehensive testing. Could you please review this new implementation? |
Signed-off-by: Alvin <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Alvin, great start on this feature!
I left some comments below. In general, make sure to name things carefully --- try to give variables and types very specific names that cannot be misinterpreted. (I know naming is hard, so it'll take some time to get that right. No worries.)
Thank you for the review. I will try to improve the naming conventions and continue working on it. |
Signed-off-by: Alvin <[email protected]>
Signed-off-by: Alvin <[email protected]>
Signed-off-by: Alvin <[email protected]>
Signed-off-by: Alvin <[email protected]>
Signed-off-by: Alvin <[email protected]>
273f1f1
to
734536b
Compare
Signed-off-by: Alvin <[email protected]>
} | ||
} | ||
} | ||
|
||
if let Some(LoginAction::LoginSuccess) = action.downcast_ref() { | ||
log!("Received LoginAction::LoginSuccess, hiding login view."); | ||
self.app_state.logged_in = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to call cx.action(RoomsPanelAction::DockLoad); To restore User's previous Dock state, as you cx.action(RoomsPanelAction::DockLoad) when login out.
src/home/spaces_dock.rs
Outdated
WidgetUid(0), | ||
&Scope::empty().path, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use either self.widget_uid().
use scope.path when there is scope.
|
||
|
||
impl LogoutConfirmModalRef { | ||
/// See [`LogoutConfirmModal::set_message()`]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For document linking, LogoutConfirmModal::set_message needs to be public function.
It is might better using Tokio's shutdown background to close all asynchronous task. |
src/app.rs
Outdated
|
||
pub fn show_logout_confirm_modal(&self, cx: &mut Cx) { | ||
let modal = self.ui.modal(id!(logout_confirm_modal)); | ||
modal.open(cx); | ||
} | ||
|
||
pub fn hide_logout_confirm_modal(&self, cx: &mut Cx) { | ||
let modal = self.ui.modal(id!(logout_confirm_modal)); | ||
log!("Got modal reference for hiding: {:?}", modal); | ||
modal.close(cx); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just a simple wrapper around the modal's open and hide methods. I feel like we can just call self.ui.modal(id!(logout_confirm_modal)).open()
or hide()
directly, without adding extra wrappers.
I once implemented a modal for Moly: https://github.com/moxin-org/moly/pull/341/files. |
I opted against using both shutdown_background and shutdown_timeout because they immediately begin closing the Tokio runtime, which causes subsequent async tasks to fail. Our logout flow still requires the runtime for critical operations like cleaning up state and sending notifications after the core tasks are aborted. I tested both shutdown methods and they proved problematic, resulting in incomplete logout processes where the application wouldn't properly transition to the login state. |
I don't see what issue there is https://github.com/alanpoon/robrix/tree/fix-logout-shutdown. The issue is that your "logout_successful = true" is inside successful response of client.matrix_auth().logout() which is not necessary. If the access token is invalid -> client.matrix_auth().logout() will fail. But access token is invalid is also logged out state. |
Signed-off-by: Alvin <[email protected]>
Signed-off-by: Alvin <[email protected]>
I noticed that my review has been requested here and that this has been marked as Can you guys clarify the relationship between these PRs and which one I should be looking at? |
Regarding PR494, I had a discussion with @alanpoon about which method to use for terminating asynchronous tasks in Tokio. After our discussion, we concluded that using As a result, I have updated the original code to implement the I kindly request a review of the current PR to ensure that the implementation aligns with our project standards and effectively addresses the task termination requirements. Your feedback on this updated approach would be greatly appreciated. Please let me know if you need any further information or clarification on the changes made. Thank you for your time and consideration. @kevinaboos |
Based on PR #293, I found an error message during logout:
2024-12-24T07:58:55.514036Z ERROR matrix_sdk_ui::sync_service: Error while processing encryption in sync service: Something wrong happened in sliding sync: the server returned an error: [401 / M_UNKNOWN_TOKEN] Invalid access token passed.
Root cause:
The error is related to SYNC_SERVICE handling during logout process.
Changes: