Skip to content
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

Reddit inline tips link on post menu will now appear #2665

Merged
merged 1 commit into from
Jun 21, 2019

Conversation

jasonrsadler
Copy link
Contributor

@jasonrsadler jasonrsadler commented Jun 11, 2019

Fixes brave/brave-browser#4915

brave-ui: brave/brave-ui#498 brave/brave-ui#501

Submitter Checklist:

Test Plan:

  1. Visit reddit.com with Rewards enabled and ensure that tip link shows on reddit posts' flat menu
  2. Go to rewards settings->tip settings and uncheck the box for 'reddit' and ensure that inline tip links do not show on reddit.
  3. Ensure tipping banner is correct when using reddit inline tipping link.

Reviewer Checklist:

  • New files have MPL-2.0 license header.
  • Request a security/privacy review as needed.
  • Adequate test coverage exists to prevent regressions
  • Verify test plan is specified in PR before merging to source

After-merge Checklist:

  • The associated issue milestone is set to the smallest version that the
    changes has landed on.
  • All relevant documentation has been updated.

@jasonrsadler jasonrsadler force-pushed the reddit-inline branch 3 times, most recently from 2befd94 to 1da9930 Compare June 11, 2019 18:34
@mihaiplesa mihaiplesa added CI/skip-android Do not run CI builds for Android CI/skip-ios Do not run CI builds for iOS CI/skip-linux labels Jun 11, 2019
@jasonrsadler jasonrsadler force-pushed the reddit-inline branch 13 times, most recently from 40d333e to 225ccb9 Compare June 13, 2019 13:26
@jasonrsadler jasonrsadler self-assigned this Jun 13, 2019
@jasonrsadler jasonrsadler force-pushed the reddit-inline branch 4 times, most recently from 722cae1 to e2a818d Compare June 13, 2019 20:25
@jasonrsadler jasonrsadler removed CI/skip-android Do not run CI builds for Android CI/skip-ios Do not run CI builds for iOS CI/skip-linux labels Jun 14, 2019
@NejcZdovc
Copy link
Contributor

@jasonrsadler I asked for refactor and I stopped at that point. I didn't do a full review, sorry other things are going on. Today I did a full review

@jasonrsadler jasonrsadler force-pushed the reddit-inline branch 2 times, most recently from db8f9a5 to 67c7aa3 Compare June 20, 2019 16:17
@jasonrsadler
Copy link
Contributor Author

jasonrsadler commented Jun 20, 2019

Thanks. refactor was pushed to post PR as was discussed before your original review so not sure why review here was partial. Understand lots going on.

@jasonrsadler jasonrsadler force-pushed the reddit-inline branch 2 times, most recently from 13bb864 to 49d7004 Compare June 21, 2019 01:45
@jasonrsadler jasonrsadler requested a review from NejcZdovc June 21, 2019 01:46
redditMetaData.postText.length > 0
? 'redditTipTitle'
: 'redditTipTitleEmpty'
publisher.title = 'u/' + getLocale(key, { user: redditMetaData.userName })
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't this be like publisher.title = getLocale(key, { user: 'u/' + redditMetaData.userName })?

Copy link
Contributor

Choose a reason for hiding this comment

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

image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@NejcZdovc
Copy link
Contributor

NejcZdovc commented Jun 21, 2019

@jasonrsadler are we not displaying reddit box for posts? Is this intentionally?

Post:
image

Banner:
image

@NejcZdovc
Copy link
Contributor

NejcZdovc commented Jun 21, 2019

@jasonrsadler we need tweet out on thank you page on reddit as well, like we have it on twitter tips, right?

image

If I tip through the panel I see tweet box
image

}
GURL url(REDDIT_USER_URL + ledger_->URIEncode(user_name));
if (!url.is_valid()) {
callback(ledger::Result::TIP_ERROR, std::move(publisher_info));
Copy link
Contributor

Choose a reason for hiding this comment

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

should we return info here or just null if we have an error?

Copy link
Contributor

Choose a reason for hiding this comment

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

based on other callbacks with errors I would say just return nullptr

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

const std::string favicon_url = GetProfileImageUrl(data);
const std::string media_key = GetMediaKey(user_name, REDDIT_MEDIA_TYPE);

if (publisher_key.empty()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: maybe try to exit as soon as possible

So when we get publisher_key on line 320 we check if valid, before continue parsing other things

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

ledger_->SaveMediaVisit(publisher_key,
*visit_data,
0,
0,
Copy link
Contributor

Choose a reason for hiding this comment

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

we need to pass window_id into SavePublisherInfo so that correct panel is updated

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@jasonrsadler jasonrsadler force-pushed the reddit-inline branch 2 times, most recently from 61b65e1 to f9ad478 Compare June 21, 2019 11:35
@jasonrsadler
Copy link
Contributor Author

For posts, there was a dom change. That is fixed.

For tweet on tip, the original thinking was that it wouldn't be available for inline reddit. However, never got an official word so it is restored.

@jasonrsadler jasonrsadler requested a review from NejcZdovc June 21, 2019 11:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement Reddit inline tipping for flat menu
5 participants