-
Notifications
You must be signed in to change notification settings - Fork 140
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
Account migrate/merge (experimental only) #1524
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cb66b0a
to
a4a7da9
Compare
If a GitHub identity link fails because the identity is linked to another account, we dispatch an `ACCOUNT_MIGRATION_NEEDED` action, which initializes a new `AccountMigration` record in the `PROPOSED` state. This migration record retains the Firebase credential of the account that would be merged. The UI should use the existence of a proposed account migration to display a model confirming that the user wishes to proceed.
If an attempt to link a GitHub identity requires a merge, display a modal explaining the situation and asking the user whether they wish to proceed. A couple of interesting pieces here: * We now make a request directly to the GitHub API to retrieve the profile of the GitHub account in question, so that we can display its avatar and username in the modal. * As a corollary, the data model for a migration now contains an entire (synthetic) `UserAccount` record, including the credential in question, rather than just the credential itself. * There is now a general-purpose `<Modal>` component that displays its contents in a modal dialog, which is rendered using a portal. This cargo-cults styles from a couple of unmerged PRs, but the implementation is new here.
Cancel button issues `DISMISS_ACCOUNT_MIGRATION` which aborts the process and closes the modal. Migrate button issues `START_ACCOUNT_MIGRATION`, which sets the state to a “grace period” during which nothing happens and the user will have the opportunity to cancel the operation. This currently has no visible effect.
Creates a second stage of account migration, the `UNDO_GRACE_PERIOD`, which is a few seconds during which nothing happens and the user has the opportunity to stop/cancel the migration before it actually begins. The `<AccountMigration>` component is now more flexible, using the migration’s state to determine the header copy, and conditionally showing a different details sub-component for each stage.
6105e3e
to
274309f
Compare
Saga initiates account migration, which is fully encapsulated in Firebase client. Client creates a second SDK instance which is used to log into the old (GitHub) account using the credential. This instance is used to retrieve old projects and then save them to the current account. Then the credential is detached from the old account and attached to the new one.
…ocess The saga gives a five-second grace period to click the button to stop the migration. Now if you click the button before the grace period is up, the saga exits without doing anything.
We’d like a record of account migrations so that it’s possible to reconstruct what happens if something goes wrong. Bugsnag has the option to do an `info`-level severity, which seems reasonably appropriate here, and more appealing than storing the data in Firebase.
274309f
to
e8fcf40
Compare
stormsweeper
reviewed
Aug 5, 2018
return ( | ||
<Fragment> | ||
<p> | ||
{t('account-migration.preparing')} |
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.
I'd suggest adding a countdown timer here.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Sets up a process for migrating an old GitHub-based account into a new Google-based account, merging the data and credentials for the two accounts.
The process is initiated by attempting to link GitHub. If the GitHub account you try to link is already associated with another Firebase account, you’re prompted to merge them:
If you choose to proceed, there is a five second grace period during which you can cancel the operation, before anything happens (in case you clicked yes by mistake):
After five seconds have passed, the process begins:
Once it’s done, you get a success message:
Info-level notices are sent to Bugsnag when a migration attempt begins, and when it completes successfully. If there is an error during migration, it is handled by the saga, reported to Bugsnag, and an error message is displayed in the modal.
Currently this feature is only active in experimental mode; once a few people have tested it, we can wide-release it.