-
Notifications
You must be signed in to change notification settings - Fork 113
Conversation
a1833d7
to
cd6e574
Compare
PR has r+ on design. |
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.
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 /> |
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.
Looks like we should be able to conditionally show this like the adjacent components. Probably !pref.migrationExpired
?
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.
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()}> |
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.
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; |
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.
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; |
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.
Any particular reason to export as both _unconnected
and ManualMigration
?
system-addon/lib/ActivityStream.jsm
Outdated
@@ -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.", |
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.
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
.
system-addon/lib/ActivityStream.jsm
Outdated
@@ -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", {}); |
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.
nit: restore alphabetical
isExpiredStub.returns(true); | ||
|
||
instance.checkMigrationStatus(false); | ||
assert.calledOnce(setStatusStub); |
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.
nit: newline between test and check
|
||
assert.calledOnce(migrationSpy); | ||
|
||
assert.calledTwice(fakePrefs.get); |
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.
nit: excess newline?
locales/en-US/strings.properties
Outdated
|
||
# 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. |
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.
Let's just do manual_migration_explanation
locales/en-US/strings.properties
Outdated
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 |
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.
And looks like the pattern is _button
@Mardak what would be the expected behavior of cancel compared to how the current implementation works. |
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. |
e374b0d
to
0583732
Compare
fd24981
to
ca9508b
Compare
@Mardak can you have another look at this? Thanks. |
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.
Almost there. Still a couple of issues with default prefs and bind
ing in render
<FormattedMessage id="manual_migration_explanation" /> | ||
</p> | ||
<div className="manual-migration-actions actions"> | ||
<button onClick={this._cancelTour(this.props.dispatch)}> |
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.
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
.
system-addon/lib/ActivityStream.jsm
Outdated
["migrationExpired", { | ||
title: "Boolean flag that decides whether to show the migration message or not.", | ||
value: false, | ||
value_local_dev: false |
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.
The other review comment asked about why value_local_dev
is needed. You addressed the last one but left these untouched.
system-addon/lib/ActivityStream.jsm
Outdated
["migrationRemainingDays", { | ||
title: "Number of days to show the manual migration message", | ||
value: 4, | ||
value_local_dev: 2 |
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.
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)}> |
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.
This is also effectively bind
ing.
} | ||
} | ||
|
||
module.exports = connect(state => state.Prefs)(ManualMigration); |
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.
Selecting Prefs
shouldn't be needed anymore?
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.
Thanks!
Still waiting on spec for the messages, button text.
Fixes #2787