Skip to content
This repository has been archived by the owner on Feb 29, 2020. It is now read-only.

Add Manual Migration component. #2858

Merged
merged 2 commits into from
Jul 24, 2017
Merged

Conversation

piatra
Copy link
Contributor

@piatra piatra commented Jul 14, 2017

Still waiting on spec for the messages, button text.

Fixes #2787

@coveralls
Copy link

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 bug-2787-manual-migratio branch 3 times, most recently from a1833d7 to cd6e574 Compare July 20, 2017 12:17
@coveralls
Copy link

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
Contributor Author

piatra commented Jul 20, 2017

PR has r+ on design.

@coveralls
Copy link

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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()}>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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", {});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: restore alphabetical

isExpiredStub.returns(true);

instance.checkMigrationStatus(false);
assert.calledOnce(setStatusStub);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: newline between test and check


assert.calledOnce(migrationSpy);

assert.calledTwice(fakePrefs.get);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And looks like the pattern is _button

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

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 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.

@coveralls
Copy link

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

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

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

Coverage Status

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

@coveralls
Copy link

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
Contributor Author

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)}>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)}>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is also effectively binding.

}
}

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Selecting Prefs shouldn't be needed anymore?

@coveralls
Copy link

Coverage Status

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

Copy link
Member

@Mardak Mardak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@Mardak Mardak merged commit 131c7d8 into mozilla:master Jul 24, 2017
@as-pine-proxy
Copy link
Collaborator

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants