Skip to content
This repository has been archived by the owner. It is now read-only.

Add Manual Migration component. #2858

Merged
merged 2 commits into from Jul 24, 2017
Merged

Conversation

@piatra
Copy link
Collaborator

@piatra piatra commented Jul 14, 2017

Still waiting on spec for the messages, button text.

Fixes #2787

@coveralls
Copy link

@coveralls coveralls commented Jul 14, 2017

Coverage Status

Coverage remained the same at 87.576% when pulling e696d05 on piatra:bug-2787-manual-migratio into a4fd42a on mozilla:master.

@piatra piatra force-pushed the piatra:bug-2787-manual-migratio branch 3 times, most recently from a1833d7 to cd6e574 Jul 19, 2017
@coveralls
Copy link

@coveralls coveralls commented Jul 20, 2017

Coverage Status

Coverage remained the same at 86.407% when pulling cd6e574 on piatra:bug-2787-manual-migratio into e847f1f on mozilla:master.

@piatra
Copy link
Collaborator Author

@piatra piatra commented Jul 20, 2017

PR has r+ on design.

@coveralls
Copy link

@coveralls coveralls commented Jul 20, 2017

Coverage Status

Coverage remained the same at 86.407% when pulling d97102c on piatra:bug-2787-manual-migratio into e847f1f on mozilla:master.

Copy link
Member

@Mardak Mardak left a comment

Overall looks to be functioning as expected except for the "Cancel" from wizard. A bunch of various nits/renamings.

@@ -49,6 +49,7 @@ class Base extends React.Component {
<div className="outer-wrapper">
<main>
{prefs.showSearch && <Search />}
<ManualMigration />

This comment has been minimized.

@Mardak

Mardak Jul 21, 2017
Member

Looks like we should be able to conditionally show this like the adjacent components. Probably !pref.migrationExpired ?

This comment has been minimized.

@Mardak

Mardak Jul 21, 2017
Member

Or maybe even match the show pattern with showMigration and have it start true then goes false when expired.

<FormattedMessage id="manual_migration_explanation_msg" />
</p>
<div className="manual-migration-actions actions">
<button onClick={() => this._cancelTour()}>

This comment has been minimized.

@Mardak

Mardak Jul 21, 2017
Member

Pass in a bound-from-outside-render method to avoid unnecessary render. See #2928 for examples


render() {
if (this.props.values.migrationExpired === true) {
return null;

This comment has been minimized.

@Mardak

Mardak Jul 21, 2017
Member

No need for this check if Base handles not even creating the component.


module.exports = connect(state => state.Prefs)(ManualMigration);
module.exports._unconnected = ManualMigration;
module.exports.ManualMigration = ManualMigration;

This comment has been minimized.

@Mardak

Mardak Jul 21, 2017
Member

Any particular reason to export as both _unconnected and ManualMigration?

@@ -81,6 +82,21 @@ const PREFS_CONFIG = new Map([
"provider_name": "Pocket",
"provider_icon": "pocket"
}`
}],
["migrationExpired", {
title: "Boolean flag that will always be true once the migration period has passed.",

This comment has been minimized.

@Mardak

Mardak Jul 21, 2017
Member

Not sure if this is better named as "migrationDismissed" or "migrationDone" or as it is right now could be fine. The description is not as accurate in that there's multiple ways that it becomes true.

@@ -20,6 +20,7 @@ const {TelemetryFeed} = Cu.import("resource://activity-stream/lib/TelemetryFeed.
const {TopSitesFeed} = Cu.import("resource://activity-stream/lib/TopSitesFeed.jsm", {});
const {DummySectionFeed} = Cu.import("resource://activity-stream/lib/DummySectionFeed.jsm", {});
const {TopStoriesFeed} = Cu.import("resource://activity-stream/lib/TopStoriesFeed.jsm", {});
const {ManualMigration} = Cu.import("resource://activity-stream/lib/ManualMigration.jsm", {});

This comment has been minimized.

@Mardak

Mardak Jul 21, 2017
Member

nit: restore alphabetical

isExpiredStub.returns(true);

instance.checkMigrationStatus(false);
assert.calledOnce(setStatusStub);

This comment has been minimized.

@Mardak

Mardak Jul 21, 2017
Member

nit: newline between test and check


assert.calledOnce(migrationSpy);

assert.calledTwice(fakePrefs.get);

This comment has been minimized.

@Mardak

Mardak Jul 21, 2017
Member

nit: excess newline?


# LOCALIZATION NOTE (manual_migration_explanation_msg): This message is show to encourage users to
# import their browser profile from another browsers they might be using.
manual_migration_explanation_msg=Try Firefox with your favorite sites, bookmarks, and passwords from another browser.

This comment has been minimized.

@Mardak

Mardak Jul 21, 2017
Member

Let's just do manual_migration_explanation

manual_migration_explanation_msg=Try Firefox with your favorite sites, bookmarks, and passwords from another browser.
# LOCALIZATION NOTE (manual_migration_cancel_btn): This message is shown on a button that cancels the
# process of importing a browser profile into Firefox.
manual_migration_cancel_btn=No Thanks

This comment has been minimized.

@Mardak

Mardak Jul 21, 2017
Member

And looks like the pattern is _button

@Mardak Mardak assigned piatra and unassigned Mardak Jul 21, 2017
@piatra
Copy link
Collaborator Author

@piatra piatra commented Jul 22, 2017

@Mardak what would be the expected behavior of cancel compared to how the current implementation works.

@Mardak
Copy link
Member

@Mardak Mardak commented Jul 22, 2017

Bryant says cancel is the least important one but the spec says to also dismiss the manual migration message if the user hits cancel: #2787 (comment)

If there's no similar "Migration:Ended" event for "Migration:Cancel" then that would need to be added to mozilla-central, but this PR can land without that given its lower priority.

@piatra piatra force-pushed the piatra:bug-2787-manual-migratio branch from e374b0d to 0583732 Jul 23, 2017
@coveralls
Copy link

@coveralls coveralls commented Jul 23, 2017

Coverage Status

Coverage remained the same at 86.407% when pulling 0583732 on piatra:bug-2787-manual-migratio into 75e5bec on mozilla:master.

@coveralls
Copy link

@coveralls coveralls commented Jul 23, 2017

Coverage Status

Coverage remained the same at 86.407% when pulling 61a2df0 on piatra:bug-2787-manual-migratio into 75e5bec on mozilla:master.

@coveralls
Copy link

@coveralls coveralls commented Jul 24, 2017

Coverage Status

Coverage remained the same at 86.407% when pulling 4b4bc06 on piatra:bug-2787-manual-migratio into 75e5bec on mozilla:master.

@coveralls
Copy link

@coveralls coveralls commented Jul 24, 2017

Coverage Status

Coverage remained the same at 86.407% when pulling fd24981 on piatra:bug-2787-manual-migratio into 75e5bec on mozilla:master.

@piatra piatra force-pushed the piatra:bug-2787-manual-migratio branch from fd24981 to ca9508b Jul 24, 2017
@coveralls
Copy link

@coveralls coveralls commented Jul 24, 2017

Coverage Status

Coverage remained the same at 86.407% when pulling ca9508b on piatra:bug-2787-manual-migratio into 75e5bec on mozilla:master.

@piatra
Copy link
Collaborator Author

@piatra piatra commented Jul 24, 2017

@Mardak can you have another look at this? Thanks.

@piatra piatra assigned Mardak and unassigned piatra Jul 24, 2017
Copy link
Member

@Mardak Mardak left a comment

Almost there. Still a couple of issues with default prefs and binding in render

<FormattedMessage id="manual_migration_explanation" />
</p>
<div className="manual-migration-actions actions">
<button onClick={this._cancelTour(this.props.dispatch)}>

This comment has been minimized.

@Mardak

Mardak Jul 24, 2017
Member

This does avoid the bind call directly within render but it's still binding a function so that every potential render of ManualMigration will force a rerendering because it's not === due to a new function. You should just do the usual bind in constructor.

["migrationExpired", {
title: "Boolean flag that decides whether to show the migration message or not.",
value: false,
value_local_dev: false

This comment has been minimized.

@Mardak

Mardak Jul 24, 2017
Member

The other review comment asked about why value_local_dev is needed. You addressed the last one but left these untouched.

["migrationRemainingDays", {
title: "Number of days to show the manual migration message",
value: 4,
value_local_dev: 2

This comment has been minimized.

@Mardak

Mardak Jul 24, 2017
Member

Same thing here value_local_dev to be explicit.

<button onClick={this._cancelTour(this.props.dispatch)}>
<FormattedMessage id="manual_migration_cancel_button" />
</button>
<button className="done" onClick={this._launchTour(this.props.dispatch)}>

This comment has been minimized.

@Mardak

Mardak Jul 24, 2017
Member

This is also effectively binding.

}
}

module.exports = connect(state => state.Prefs)(ManualMigration);

This comment has been minimized.

@Mardak

Mardak Jul 24, 2017
Member

Selecting Prefs shouldn't be needed anymore?

@coveralls
Copy link

@coveralls coveralls commented Jul 24, 2017

Coverage Status

Coverage remained the same at 86.407% when pulling 52c52ae on piatra:bug-2787-manual-migratio into 75e5bec on mozilla:master.

@Mardak
Mardak approved these changes Jul 24, 2017
Copy link
Member

@Mardak Mardak left a comment

Thanks!

@Mardak Mardak merged commit 131c7d8 into mozilla:master Jul 24, 2017
2 checks passed
2 checks passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage remained the same at 86.407%
Details
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants