-
Notifications
You must be signed in to change notification settings - Fork 905
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Show verified publishers in Rewards panel for new Twitter #3029
Conversation
3ec6324
to
34d2c67
Compare
ef0b25e
to
4ad0e47
Compare
ceb947e
to
3c80742
Compare
components/brave_rewards/resources/extension/brave_rewards/background/api/tabs_api.ts
Outdated
Show resolved
Hide resolved
c2f724b
to
708381c
Compare
components/brave_rewards/resources/extension/brave_rewards/background/api/tabs_api.ts
Show resolved
Hide resolved
vendor/bat-native-ledger/src/bat/ledger/internal/media/twitter.cc
Outdated
Show resolved
Hide resolved
other than #3029 (comment), lgtm |
708381c
to
bab104b
Compare
bab104b
to
f405b7b
Compare
I’m a little confused. It does work in my testing, but I’m trying to understand why the change is needed. Primarily, I'm worried about requesting the user details via the twitter API as soon as the page starts loading. Could this happen before the page makes any authenticated API requests, leaving our request with no auth headers yet? I'm not sure I saw that happening in my testing, but wondering if it's possible. In general, I'm finding it difficult to follow the path of data through the code between content-script / background script and API. When a user visits the page |
@petemill The main problem is that the C++ backend scrapes the DOM for the Twitter user ID, but that ID is no longer present in the new Twitter redesign. In order to work around that, we request the user ID from the Twitter API and then send it to the backend. In order to avoid adding a new parameter to our APIs for the user ID (and then threading that through Mojo), @NejcZdovc suggested to just pass a different URL that already contains everything we need for the backend parsing when dealing with a "new Twitter" profile. As far as the possibility of sending a request with no auth headers, I had the same concern. It doesn't seem to happen in practice, but it doesn't mean it's not possible. I'm definitely open to other suggestions! |
@emerick oh ok if it was already decided to do it this way instead of adding an explicit API. Thanks for the explanation @emerick. I think it would help us in the future if we add a code comment to explain exactly the above: that for old twitter, the backend parses the DOM itself, but for new twitter we fetch the userId ourselves and add it to a fake URL so the backend has everything it needs. And @NejcZdovc perhaps create an issue to modify the API to expect a specific data object where one of the properties is the |
@petemill Just to be totally clear, that isn't a fake URL. It's just an alternate URL that Twitter provides to a profile-like page (with the happy side effect that it allows us to parse a user ID from the DOM). |
f405b7b
to
f5f463a
Compare
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.
Nice solution. Thanks for clearing it up 👍
Show verified publishers in Rewards panel for new Twitter
Fix brave/brave-browser#5388
Submitter Checklist:
npm run lint
)git rebase master
(if needed).git rebase -i
to squash commits (if needed).Test Plan:
Must test this for three scenarios:
http://twitter.com/emerick
Also, for the various scenarios, please use a clean profile as the data can be cached and lead you into thinking it's working when it's not.
Reviewer Checklist:
After-merge Checklist:
changes has landed on.