mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
chore: remove anon user when sign up with a new user (#4253)
* chore: remove anon user when sign up with a new user * chore: clippy
This commit is contained in:
parent
7ba3020ab3
commit
8ccd1ec72c
@ -56,14 +56,14 @@ void main() {
|
||||
|
||||
// tap the continue as anonymous button
|
||||
await tester
|
||||
.tapButton(find.text(LocaleKeys.signIn_continueAnonymousUser.tr()));
|
||||
.tapButton(find.text(LocaleKeys.signIn_loginStartWithAnonymous.tr()));
|
||||
await tester.expectToSeeHomePage();
|
||||
|
||||
// assert the name of the anon user is local_user
|
||||
// New anon user name
|
||||
await tester.openSettings();
|
||||
await tester.openSettingsPage(SettingsPage.user);
|
||||
final userNameInput = tester.widget(userNameFinder) as UserNameInput;
|
||||
expect(userNameInput.name, 'local_user');
|
||||
expect(userNameInput.name, 'Me');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -415,6 +415,7 @@ impl UserManager {
|
||||
self
|
||||
.migrate_anon_user_data_to_cloud(&old_user, &new_user, authenticator)
|
||||
.await?;
|
||||
self.remove_anon_user();
|
||||
let _ = self.database.close(old_user.session.user_id);
|
||||
}
|
||||
}
|
||||
|
@ -40,6 +40,10 @@ impl UserManager {
|
||||
let _ = self.store_preferences.set_object(ANON_USER, session);
|
||||
}
|
||||
|
||||
pub fn remove_anon_user(&self) {
|
||||
self.store_preferences.remove(ANON_USER);
|
||||
}
|
||||
|
||||
pub async fn get_anon_user(&self) -> FlowyResult<UserProfilePB> {
|
||||
let anon_session = self
|
||||
.store_preferences
|
||||
|
Loading…
Reference in New Issue
Block a user