Skip to content

Commit 8ccd1ec

Browse files
authored
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
1 parent 7ba3020 commit 8ccd1ec

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

frontend/appflowy_flutter/integration_test/cloud/anon_user_continue_test.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,14 @@ void main() {
5656

5757
// tap the continue as anonymous button
5858
await tester
59-
.tapButton(find.text(LocaleKeys.signIn_continueAnonymousUser.tr()));
59+
.tapButton(find.text(LocaleKeys.signIn_loginStartWithAnonymous.tr()));
6060
await tester.expectToSeeHomePage();
6161

62-
// assert the name of the anon user is local_user
62+
// New anon user name
6363
await tester.openSettings();
6464
await tester.openSettingsPage(SettingsPage.user);
6565
final userNameInput = tester.widget(userNameFinder) as UserNameInput;
66-
expect(userNameInput.name, 'local_user');
66+
expect(userNameInput.name, 'Me');
6767
});
6868
});
6969
}

frontend/rust-lib/flowy-user/src/manager.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,7 @@ impl UserManager {
415415
self
416416
.migrate_anon_user_data_to_cloud(&old_user, &new_user, authenticator)
417417
.await?;
418+
self.remove_anon_user();
418419
let _ = self.database.close(old_user.session.user_id);
419420
}
420421
}

frontend/rust-lib/flowy-user/src/services/historical_user.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ impl UserManager {
4040
let _ = self.store_preferences.set_object(ANON_USER, session);
4141
}
4242

43+
pub fn remove_anon_user(&self) {
44+
self.store_preferences.remove(ANON_USER);
45+
}
46+
4347
pub async fn get_anon_user(&self) -> FlowyResult<UserProfilePB> {
4448
let anon_session = self
4549
.store_preferences

0 commit comments

Comments
 (0)