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:
@ -56,14 +56,14 @@ void main() {
|
|||||||
|
|
||||||
// tap the continue as anonymous button
|
// tap the continue as anonymous button
|
||||||
await tester
|
await tester
|
||||||
.tapButton(find.text(LocaleKeys.signIn_continueAnonymousUser.tr()));
|
.tapButton(find.text(LocaleKeys.signIn_loginStartWithAnonymous.tr()));
|
||||||
await tester.expectToSeeHomePage();
|
await tester.expectToSeeHomePage();
|
||||||
|
|
||||||
// assert the name of the anon user is local_user
|
// New anon user name
|
||||||
await tester.openSettings();
|
await tester.openSettings();
|
||||||
await tester.openSettingsPage(SettingsPage.user);
|
await tester.openSettingsPage(SettingsPage.user);
|
||||||
final userNameInput = tester.widget(userNameFinder) as UserNameInput;
|
final userNameInput = tester.widget(userNameFinder) as UserNameInput;
|
||||||
expect(userNameInput.name, 'local_user');
|
expect(userNameInput.name, 'Me');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -415,6 +415,7 @@ impl UserManager {
|
|||||||
self
|
self
|
||||||
.migrate_anon_user_data_to_cloud(&old_user, &new_user, authenticator)
|
.migrate_anon_user_data_to_cloud(&old_user, &new_user, authenticator)
|
||||||
.await?;
|
.await?;
|
||||||
|
self.remove_anon_user();
|
||||||
let _ = self.database.close(old_user.session.user_id);
|
let _ = self.database.close(old_user.session.user_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,6 +40,10 @@ impl UserManager {
|
|||||||
let _ = self.store_preferences.set_object(ANON_USER, session);
|
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> {
|
pub async fn get_anon_user(&self) -> FlowyResult<UserProfilePB> {
|
||||||
let anon_session = self
|
let anon_session = self
|
||||||
.store_preferences
|
.store_preferences
|
||||||
|
Reference in New Issue
Block a user