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

Fixes favicon image for verified youtube publishers #1649

Merged
merged 1 commit into from
Feb 14, 2019
Merged

Conversation

NejcZdovc
Copy link
Contributor

@NejcZdovc NejcZdovc commented Feb 13, 2019

Resolves brave/brave-browser#3324

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).
  • Verified that these changes build without errors on
    • Windows
    • macOS
    • Linux
  • Verified that these changes pass automated tests (npm test brave_unit_tests && npm test brave_browser_tests) on
    • Windows
    • macOS
    • Linux
  • Ran git rebase master (if needed).
  • Ran git rebase -i to squash commits (if needed).
  • Tagged reviewers and labelled the pull request as needed.
  • Request a security/privacy review as needed.
  • Add appropriate QA labels (QA/Yes or QA/No) to include the closed issue in milestone

Test Plan:

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

@NejcZdovc NejcZdovc added this to the 0.62.x - Nightly milestone Feb 13, 2019
@NejcZdovc NejcZdovc self-assigned this Feb 13, 2019
@NejcZdovc NejcZdovc requested review from ryanml and removed request for ryanml and jasonrsadler February 13, 2019 05:40
@NejcZdovc NejcZdovc force-pushed the verified-image branch 2 times, most recently from dbe9211 to 320b548 Compare February 13, 2019 11:38
publisher_info_statement.Run();

std::string favicon = info.favicon_url;
if (!favicon.empty()) {
Copy link
Contributor Author

@NejcZdovc NejcZdovc Feb 13, 2019

Choose a reason for hiding this comment

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

because we have race condition (multiple requests try to update publisher info) we could be overriding already fetched favicon with an empty string (string is empty, because fetch was canceled and default value in struct for favicon is empty string). So we need to be carful when to update favicon.

sql::Statement publisher_info_statement(
GetDB().GetCachedStatement(SQL_FROM_HERE,
"INSERT OR REPLACE INTO publisher_info "
"(publisher_id, verified, excluded, "
"name, url, provider, favIcon) "
"VALUES (?, ?, ?, ?, ?, ?, ?)"));
"VALUES (?, ?, ?, ?, ?, ?, "
"(SELECT IFNULL( "
Copy link
Contributor Author

Choose a reason for hiding this comment

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

if publisher doesn't exist we need to default favicon to empty string

@@ -220,7 +220,7 @@ void BatPublishers::saveVisitInternal(
publisher_info->favicon_url = fav_icon;
}
} else {
publisher_info->favicon_url = std::string();
publisher_info->favicon_url = ledger::clear_favicon;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

we need to force clear if user is not verified

@NejcZdovc NejcZdovc mentioned this pull request Feb 14, 2019
18 tasks
@NejcZdovc NejcZdovc merged commit 24e1201 into master Feb 14, 2019
@NejcZdovc NejcZdovc deleted the verified-image branch February 14, 2019 16:24
NejcZdovc added a commit that referenced this pull request Feb 14, 2019
Fixes favicon image for verified youtube publishers
NejcZdovc added a commit that referenced this pull request Feb 14, 2019
Fixes favicon image for verified youtube publishers
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.

incorrect verified youtube publisher favicons in auto contribute table
2 participants