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

Add Auto-suggest sites option, to prefs and urlBar #6422

Closed
wants to merge 0 commits into from
Closed

Add Auto-suggest sites option, to prefs and urlBar #6422

wants to merge 0 commits into from

Conversation

cezaraugusto
Copy link
Contributor

@cezaraugusto cezaraugusto commented Dec 25, 2016

Auditors: @mrose17, @bsclifton

Fix #6261

Note before merging: I cherry-picked PR #6101 from @jkup + polish from @luixxiul, which this PR is depedent. Will need rebase after those being approved.

PR adds a new "auto-suggest sites" option, and a "remote control" for that option on URL bar.

Screenshots:

Enabled publisher icon

screen shot 2016-12-25 at 18 51 22

Disabled publisher icon

screen shot 2016-12-25 at 18 51 37

New options on Preferences->Payments

screen shot 2016-12-25 at 18 51 50

Test plan

Automated tests:

npm run unittest -- --grep="PublisherToggle component" 

Manual tests:

Case 1 (Publisher exists and is disabled)

  • Go to about:preferences -> Payments. Enable Payments and disable "auto-suggest sites" and "only show included sites" options;
  • Have at least two publishers on Payments. Ensure one of them is enabled;
  • Go to enabled publisher URL. Url bar should have an orange BitCoin button right after;
  • Clicking the button should turn it gray;
  • Back to Publishers panel, publisher should now be disabled;

Case 2 (Publisher exists and is enabled)

  • Same steps as the above;
  • Clicking the orange button should turn it gray;
  • Back to Publishers panel, publisher should now be enabled;

Case 3 (Publisher doesn't exist yet)

  • Go to a new publisher URL.
  • Spend enough time and visits to ensure Publisher can be on Payments list
  • On Publishers list, the newest publisher should be disabled;
  • Go back to newest publisher Url. Hit the BitCoin button. It should be orange;
  • Go to Publishers list again, publisher should be enabled;

Edge Case 1 (User has both "auto-suggest sites" and "only show included sites" options enabled)

  • Enable both "auto-suggest sites" and "only show incuded sites" options on Payments;
  • Go to a publisher url. BitCoin icon should not be visible;

Edge Case 2 (User has Payments disabled)

  • Disable "auto-suggest sites" and "only show included sites" options;
  • Disable Payments;
  • Go to a Publisher url, hit BitCoin icon;
  • Payments should be enabled

Merge notes

Must be merged AFTER #6101

@bsclifton
Copy link
Member

bsclifton commented Dec 26, 2016

@mrose17 I know you and @cezaraugusto have been working out the remaining work. As it stands now, what's left?

Copy link
Member

@mrose17 mrose17 left a comment

Choose a reason for hiding this comment

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

LGTM

@luixxiul
Copy link
Contributor

luixxiul commented Dec 29, 2016

Pushed the commit 31206be to align the elements:

screenshot 2016-12-29 11 30 21

Also: #6285

}
}

.paymentsMessage {
background-color: @lightGray;
border-radius: @borderRadiusUIbox;
margin: @walletBarMargin;
margin-top: @walletBarMargin;
Copy link
Contributor

Choose a reason for hiding this comment

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

This fixes the regression I introduced with the former commit of the PR.

Test Plan:

  1. Disable payments
  2. Make sure the sidebar is not wrapped

@@ -745,6 +743,12 @@
min-height: @urlbarFormHeight;
min-width: @urlbarFormHeight;
-webkit-app-region: no-drag;
Copy link
Contributor

@luixxiul luixxiul Dec 29, 2016

Choose a reason for hiding this comment

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

@cezaraugusto I added this here because I thought this is required for .addPublisherButtonContainer too. Is it OK?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, thanks!

@bsclifton
Copy link
Member

@cezaraugusto I believe this is complete, right? Did you finish with tests?

@jkup had some great examples you can check out here:
#6460
#6529

@bsclifton bsclifton added this to the 0.13.1 milestone Jan 5, 2017
Copy link
Member

@bsclifton bsclifton left a comment

Choose a reason for hiding this comment

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

I'm trying this out and just found a small issue... otherwise, it looks great

@bsclifton
Copy link
Member

bsclifton commented Jan 6, 2017

Here's the issue I found. If it's too large, we can create a new issue for it and resolve at a later date

  • Move session folder out of the way
  • Launch Brave and disable auto suggest sites (since it's enabled by default)
  • Visit "wikipedia.org" or "cnn.com" and let the site finish loading
  • Notice that the bitcoin button (to the right of the URL bar) is not visible
  • Refresh page
  • Notice that the bitcoin icon (to the right of the URL bar) is visible now

@bsclifton
Copy link
Member

@mrose17 @bradleyrichter the PR still needs some work, but in the meantime, I have pushed a copy of Cezar's fork into the main brave/browser-laptop repo. You can access this with the branch auto-suggest-sites:
https://github.com/brave/browser-laptop/tree/auto-suggest-sites

@cezaraugusto
Copy link
Contributor Author

Needs some rebase and tests, but works as-is. Thanks @bsclifton

@luixxiul
Copy link
Contributor

luixxiul commented Jan 8, 2017

@cezaraugusto I added tiny fixes.

Copy link
Member

@bsclifton bsclifton left a comment

Choose a reason for hiding this comment

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

As-is, we have a few problems ☹️

  • The hostPattern in navigationBar.js only allows for HTTPS, so this logic doesn't work for HTTP sites
  • The first page load doesn't show the icon. To demo, visit https://en.wikipedia.org/wiki/Main_Page. If the icon shows for you, pick another language on the left (which you haven't viewed before). When doing the first load, you'll notice the bitcoin icon does NOT show

@cezaraugusto
Copy link
Contributor Author

@bsclifton, actually for hostPattern, it's just a pattern defined by ledger itself, so any location stored there follows the same rule, being HTTP/HTTPS. All I do is picking domain and adding https?://${getDomain} pattern, so protocol is ignored.

For first page load issue, I found that issue but was intermittent so thanks for describing STR. I did a push with a fix, lmk if that's was addressed.

@luixxiul rebased and amended with your previous one, lmk if it's good now, thanks!!

@luixxiul
Copy link
Contributor

luixxiul commented Jan 9, 2017

file changed count: 465?? @cezaraugusto

display: flex;
align-items: center;
height: 25px;
width: 25px;
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's remove those added properties above in .addPublisherButtonContainer

Copy link
Contributor

Choose a reason for hiding this comment

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

cf: 2075547

@luixxiul
Copy link
Contributor

luixxiul commented Jan 9, 2017

@cezaraugusto It seems that you're including other files on your local machine

@@ -671,6 +671,7 @@
content: ' ';
position: absolute;
background: #fff;
border: 1px solid @focusUrlbarOutline;
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated, thanks!

@luixxiul
Copy link
Contributor

luixxiul commented Jan 9, 2017

I checked LESS files were updated, thanks for updating :-)

Copy link
Member

@bsclifton bsclifton left a comment

Choose a reason for hiding this comment

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

OK- just gave this a go... awesome work 😄

Almost everything works as expected. I only noticed one problem. Basically, if I have these conditions:

  • fresh session (move the folder out of the way)
  • Auto suggest sites disabled

And I visit a site which I had not been to before (ex: brianbondy.com), then I am properly shown the bitcoin icon in the URL bar. However, if I click it and then go into preferences > Payments, it doesn't immediately get added to the list. This is because the list is considering the advanced settings.

Is there a way to force the site through? If so and it's an easy fix, let's do it 😄 otherwise let's create an issue and we can follow up on this soon!

(otherwise approved! again- great job 😄)

@luixxiul luixxiul mentioned this pull request Jan 10, 2017
4 tasks
@cezaraugusto
Copy link
Contributor Author

@bsclifton we could create an action to force the publisher to be on ledger payments and skip settings rules (min visit/min timestamp). Currently it will be enabled once you hit the bitCoin icon but will not be included unless advanced settings' rules are fulfilled.

Can't say however if we should delay this PR in favour of adding it, or it's ok to do that as a follow-up. @mrose17 what do you think?

this.props.ledgerData.get('created') && this.enabled
? <Button
l10nId='advancedSettings'
className='advancedSettings whiteButton'
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Member

@bsclifton bsclifton left a comment

Choose a reason for hiding this comment

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

@cezaraugusto I talked with @mrose17 and created #6592 as a follow up. Approved! 😄

@luixxiul
Copy link
Contributor

luixxiul commented Jan 11, 2017

@cezaraugusto: Will you please not drop my 7ccae16 of this PR as the original one will be was dropped instead of it? Thanks! #6101 (comment) /cc: @jkup

@luixxiul
Copy link
Contributor

ok @cezaraugusto, because #6101 was merged into 0.13-branch, will you drop 3e791cb of this PR?

As I've asked you, please do not drop 7ccae16. Thanks :-)

@cezaraugusto
Copy link
Contributor Author

PR updated with automated tests

@luixxiul
Copy link
Contributor

@cezaraugusto please drop 3339539 which has been already merged in 0.13.1-branch

@bsclifton bsclifton changed the base branch from master to 0.13.1-branch January 13, 2017 09:29
@bsclifton bsclifton closed this Jan 13, 2017
@bsclifton
Copy link
Member

I rebased and did a force update and for some reason, GitHub closed this?!

@bsclifton
Copy link
Member

ok I understand what I did wrong (this was completely my fault). I didn't set the tracking for your remote when I did the rebase ☹️ I didn't fetch before doing this either, so I don't have the commit in my reflog

Should be easy to fix though! @cezaraugusto, can you re-push your local branch to your fork? It should have the sha ecbadaa

@luixxiul
Copy link
Contributor

@bsclifton should I too?

@luixxiul
Copy link
Contributor

luixxiul commented Jan 13, 2017

Otherwise please cherry-pick 7ccae16

Edit: Or I would by myself with another PR, which I think is better. Let me know :-)

@luixxiul luixxiul added needs-info Another team member needs information from the PR/issue opener. and removed PR/ready-for-merge labels Jan 13, 2017
@cezaraugusto
Copy link
Contributor Author

@luixxiul follow-up here, rebased against 0.13.1-branch with your changes. Lmk if I missed something:

#6633

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.

5 participants