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

Auto-include propagates correctly #7680

Merged
merged 2 commits into from
Mar 20, 2017

Conversation

NejcZdovc
Copy link
Contributor

@NejcZdovc NejcZdovc commented Mar 13, 2017

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

Resolves #7451

Auditors

@mrose17

Test Plan

  • Enable payments in settings
  • Disable auto-include switch
  • Visit brianbondy.com in a new tab, site is added in the list and is not included

Automated test plan

  • npm run test -- --grep="auto include"

@bsclifton
Copy link
Member

Added @cezaraugusto; during our face to face, this was one that he and @mrose17 were talking about. I believe Cezar had started looking into this

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!

@bsclifton
Copy link
Member

Per discussion in #7451, we need to set the include flag (since it currently changes include status for items when you toggle auto include on/off- this is very confusing for the user)

@NejcZdovc NejcZdovc force-pushed the hotfix/#7451-autoinclude branch 2 times, most recently from fa56568 to c4094cd Compare March 14, 2017 11:49
@NejcZdovc
Copy link
Contributor Author

NejcZdovc commented Mar 14, 2017

Ok so now I did two things

  1. when publisher is added we set it false if auto include is off c4094cd#diff-9b959b675446ba95e1abe0b81e0f7a9bR599
  2. I updated clean up functionality, which would go through the undefined auto include property of the publisher and set it to true (we used true as a default fallback in the UI till now) c4094cd#diff-9b959b675446ba95e1abe0b81e0f7a9bR990

This PR is ready for a second review

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!

app/ledger.js Outdated
result = synopsis.publishers[publisher].options.stickyP
} else {
result = true
}
appActions.changeSiteSetting(pattern, 'ledgerPayments', result)
}
delete synopsis.publishers[publisher].options.stickyP
Copy link
Contributor

@cezaraugusto cezaraugusto Mar 15, 2017

Choose a reason for hiding this comment

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

I think you need a check here as well. With those changes synopsis.publishers[publisher] is still undefined at this point. App is crashing for me and pointing on that line.

Worth note: if you have a site in publisher list error doesn't happen. For publishers on exclusion list (such as Youtube), crash is intermittent. Other publishers instantly crash app.

STR: With a fresh profile (no synopsis, no session, no ledger-state), enable Payments and visit a publisher site (i.e. https://clifton.io)

Copy link
Contributor Author

@NejcZdovc NejcZdovc Mar 15, 2017

Choose a reason for hiding this comment

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

Ok, but why would be failing now. It was outside the if statement before this PR. It was strange for me when I was doing this change, but I left it there because it was there before. Will move it inside the if

Copy link
Contributor

Choose a reason for hiding this comment

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

nice, let's cc @mrose17 for thoughts

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@cezaraugusto can you please try again. I rebase it on the master and now I don't have any crashes.

Copy link
Contributor

@cezaraugusto cezaraugusto Mar 16, 2017

Choose a reason for hiding this comment

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

thanks, no crashes this time. However I followed STR and publisher is still auto-including for me as soon as it populates payments panel.

I did a look inside publisherToggle (only part besides payments that changes publisher state) but state is only changed there if you hit urlbar icon, so it must come from ledger itself.

IMO you might want something similar to this:
https://github.com/brave/browser-laptop/pull/7289/files#diff-9b959b675446ba95e1abe0b81e0f7a9bL566

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's working for me. Do you have auto include set to off in payments?

Copy link
Contributor

@cezaraugusto cezaraugusto Mar 16, 2017

Choose a reason for hiding this comment

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

yep, I removed last comment with wrong video showing STR. After your update it's working fine.

What I saw is that, if you have a clear session with a synopsis file, publishers you had previously are affected by changing auto-suggest, which should only be applied for new publishers. Note that without clearing session-store it works perfectly:

STR:

  1. remove session-store file
  2. keep ledger-synopsis.json (supposing it has publishers)

gif_auto_include_old_synopsis

I suppose auto-include should only apply for new publishers and not for existing ones? If I'm wrong then PR is good to go ;)

Copy link
Contributor Author

@NejcZdovc NejcZdovc Mar 16, 2017

Choose a reason for hiding this comment

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

No this is something that needs to be fixed. I have implemented this, but it was causing a crash for some X reason (you noticed this in your first comment). So I removed it for now and will try to find another solution today

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@cezaraugusto I changed the logic now, can you please try it again

@NejcZdovc NejcZdovc force-pushed the hotfix/#7451-autoinclude branch 7 times, most recently from f7fc142 to a9e6e4d Compare March 18, 2017 10:25
@NejcZdovc
Copy link
Contributor Author

@bsclifton PR is ready now for a review

@NejcZdovc NejcZdovc force-pushed the hotfix/#7451-autoinclude branch 4 times, most recently from 2607ca4 to d6c1bce Compare March 19, 2017 15:48
NejcZdovc and others added 2 commits March 19, 2017 23:34
Resolves brave#7451

Auditors: @mrose17

Test Plan:
- Enable payments in settings
- Disable auto-include switch
- Visit brianbondy.com in a new tab, site is added in the list and is not included

Includes webdriver tests
…s-ci with brave#7773 and this broke the `uitest` task. Since the unit tests run quickly and `npm run unittest` still works great, this task isn't really needed anymore.

Auditors: @NejcZdovc, @diracdeltas
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.

Manually tested and also ran automated tests. Everything works as expected- great job on this one 😄

@bsclifton bsclifton merged commit bee2993 into brave:master Mar 20, 2017
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.

4 participants