Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Replace hideLower with showLess #10164

Merged
merged 1 commit into from
Aug 6, 2017
Merged

Replace hideLower with showLess #10164

merged 1 commit into from
Aug 6, 2017

Conversation

luixxiul
Copy link
Contributor

@luixxiul luixxiul commented Jul 27, 2017

Based on the discussion on Slack.

Also:

  • Rename constants to sort them not only alphabetically but semantically (just sorting alphabetically breaks the semantic order of the existing constants)
  • Add lacking states to docs/state.md

Closes #10158

Auditors:

Test Plan:

  1. Run npm run add-simulated-synopsis-visits 100
  2. Open about:preferences#payments
  3. Click Show All button
  4. Click Show Less button
  5. Make sure the buttons work

Submitter Checklist:

  • Submitted a ticket for my issue if one did not already exist.
  • Used Github auto-closing keywords in the commit message.
  • Added/updated tests for this change (for new code or code which already has tests).
  • Ran git rebase -i to squash commits (if needed).
  • Tagged reviewers and labelled the pull request as needed.

Test Plan:

Reviewer Checklist:

Tests

  • Adequate test coverage exists to prevent regressions
  • Tests should be independent and work correctly when run individually or as a suite ref
  • New files have MPL2 license header

@luixxiul luixxiul added copy/content/text misc/button polish Nice to have — usually related to front-end/visual tasks. labels Jul 27, 2017
@luixxiul luixxiul added this to the 0.20.x (Nightly Channel) milestone Jul 27, 2017
@luixxiul luixxiul self-assigned this Jul 27, 2017
docs/state.md Outdated
@@ -163,6 +163,7 @@ AppStore
'advanced.default-zoom-level': number, // the default zoom level for sites that have no specific setting
'advanced.hardware-acceleration-enabled': boolean, // false if hardware acceleration should be explicitly disabled
'advanced.hide-excluded-sites': boolean, // whether to hide excluded sites in the payments list
'advanced.show-less-sites': boolean, // whether to show less sites in the payments list
Copy link
Contributor

Choose a reason for hiding this comment

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

Please sort this alphabetically

Copy link
Contributor Author

Choose a reason for hiding this comment

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

d -> ha -> hi -> s, which is not alphabetically?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought hide-excluded-sites and show-less-sites should be grouped.

Copy link
Contributor

Choose a reason for hiding this comment

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

all properties in state.md should be sorted alphabetically

Copy link
Contributor

@NejcZdovc NejcZdovc Jul 27, 2017

Choose a reason for hiding this comment

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

now is d -> ha -> hi -> s -> m

Copy link
Contributor Author

Choose a reason for hiding this comment

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

all properties in state.md should be sorted alphabetically

so should be ones in appConfig.js right? working on it.

'payments.notificationTryPaymentsDismissed': boolean, // true if you dismiss the message or enable Payments
'payments.sites-auto-suggest': boolean, // show auto suggestion
'payments.sites-hide-excluded': boolean, // whether to hide excluded sites in the payments list
'payments.sites-show-less': boolean, // whether to show less sites in the payments list
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Renamed above 3 ones to group semantically

@codecov-io
Copy link

codecov-io commented Jul 29, 2017

Codecov Report

Merging #10164 into master will not change coverage.
The diff coverage is 100%.

@@           Coverage Diff           @@
##           master   #10164   +/-   ##
=======================================
  Coverage   52.79%   52.79%           
=======================================
  Files         227      227           
  Lines       20214    20214           
  Branches     3236     3236           
=======================================
  Hits        10672    10672           
  Misses       9542     9542
Flag Coverage Δ
#unittest 52.79% <100%> (ø) ⬆️
Impacted Files Coverage Δ
js/constants/settings.js 100% <ø> (ø) ⬆️
...components/preferences/payment/advancedSettings.js 100% <ø> (ø) ⬆️
app/renderer/components/preferences/paymentsTab.js 83.51% <100%> (ø) ⬆️
app/common/lib/publisherUtil.js 97.22% <100%> (ø) ⬆️
js/constants/appConfig.js 100% <100%> (ø) ⬆️
...erer/components/preferences/payment/ledgerTable.js 89.72% <100%> (ø) ⬆️

Also:
- Rename constants to sort them not only alphabetically but semantically
- Add lacking states to docs/state.md

Closes #10158

Auditors:

Test Plan:
1. Run `npm run add-simulated-synopsis-visits 100`
2. Open about:preferences#payments
3. Click `Show All` button
4. Click `Show Less` button
5. Make sure the buttons work
Copy link
Contributor

@cezaraugusto cezaraugusto left a comment

Choose a reason for hiding this comment

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

changes on const names look way more readable. also nice work on docs.

I'm having some ledger tests failing but seems unrelated to this PR so ++

@cezaraugusto
Copy link
Contributor

also moving to 0.21.x

@cezaraugusto cezaraugusto merged commit f0d9c3d into brave:master Aug 6, 2017
@cezaraugusto cezaraugusto deleted the polish-hideLower branch August 6, 2017 23:04
@luixxiul luixxiul modified the milestones: 0.21.x (Nightly Channel), 0.20.x (Developer Channel) Aug 6, 2017
@luixxiul luixxiul removed the request for review from NejcZdovc August 6, 2017 23:46
@luixxiul
Copy link
Contributor Author

luixxiul commented Aug 6, 2017

the milestone was moved: #10164 (comment)

@bsclifton
Copy link
Member

bsclifton commented Aug 7, 2017

@luixxiul I believe we have a problem here

We can't update the names of the preferences if they are already in production. People already have an existing value and this value is lost completely when they upgrade

Steps to reproduce:

  • Use an existing version of Brave
  • dismiss the notification to use Brave payments (this sets payments.notificationTryPaymentsDismissed)
  • Use this version of Brave (where payments.notificationTryPaymentsDismissed was renamed to payments.notification-try-payments-dismissed)
  • Notice you'll get prompted again (because the setting was lost)

I checked the other values and they all kept the same name (which is good). We have to be careful about changing the names of any existing preferences. In sessionStore.js, there is a place where you can handle this migration:

module.exports.runPreMigrations = (data) => {

cc: @cezaraugusto

@bsclifton
Copy link
Member

bsclifton commented Aug 7, 2017

The fix would look something like:

module.exports.runPreMigrations = (data) => {

  // existing code here...

  if (data.settings['payments.notificationTryPaymentsDismissed'] != null) {
    data.settings['payments.notification-try-payments-dismissed'] = data.settings['payments.notificationTryPaymentsDismissed']
  }
}

If you wanted to keep the old value (and constant), you could move the old value here:

// DEPRECATED settings

All settings stored here are no longer used. We can't ignore them though, because folks could be upgrading from an old version.

@cezaraugusto
Copy link
Contributor

sorry I was unaware of that and thanks for the heads-up. I'll came along with a follow-up to avoid revert.

@luixxiul
Copy link
Contributor Author

luixxiul commented Aug 7, 2017

@bsclifton thanks for the heads-up from me too.

@cezaraugusto thanks in advance :-)

@bsclifton
Copy link
Member

@cezaraugusto you may check out the conversation in #10181 (comment) for a proposal that would solve this issue too 😄

@bsclifton
Copy link
Member

We're running into issues and unfortunately, this PR is causing issues with the BAT Mercury work (since settings were renamed). I'm going to pull this into 0.19.x

@bsclifton bsclifton modified the milestones: 0.21.x (Nightly Channel), 0.19.x (Beta Channel) Oct 4, 2017
bsclifton pushed a commit that referenced this pull request Oct 4, 2017
…BAT Mercury.

Details:
Because the settings were renamed, git didn't properly handle changes when cherry-picking backwards.
This caused the code in 0.19.x and 0.20.x to use the naming from 0.21.x

Merge pull request #10164 from luixxiul/polish-hideLower
Replace hideLower with showLess
f0d9c3d

Merge pull request #10441 from brave/10322
add support for legacy ledger settings
052277d

Also includes fixes from 9ad7b4f (most of this commit was already backported, just grabbed the settings migration fixes)

Auditors: @NejcZdovc, @luixxiul, @cezaraugusto

Fixes #11261
Fixes #11260
Fixes #11250
Fixes #11246
Fixes #11263
bsclifton pushed a commit that referenced this pull request Oct 4, 2017
…BAT Mercury.

Details:
Because the settings were renamed, git didn't properly handle changes when cherry-picking backwards.
This caused the code in 0.19.x and 0.20.x to use the naming from 0.21.x

Merge pull request #10164 from luixxiul/polish-hideLower
Replace hideLower with showLess
f0d9c3d

Merge pull request #10441 from brave/10322
add support for legacy ledger settings
052277d

Also includes fixes from 9ad7b4f (most of this commit was already backported, just grabbed the settings migration fixes)

Auditors: @NejcZdovc, @luixxiul, @cezaraugusto

Fixes #11261
Fixes #11260
Fixes #11250
Fixes #11246
Fixes #11263
@bsclifton
Copy link
Member

master f0d9c3d
0.20.x 3bc7c1f
0.19.x be048b8

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
copy/content/text misc/button polish Nice to have — usually related to front-end/visual tasks.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants