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

Fix Brave Ads save and dislike filters #11679

Merged
merged 1 commit into from
Dec 29, 2021
Merged

Fix Brave Ads save and dislike filters #11679

merged 1 commit into from
Dec 29, 2021

Conversation

tmancey
Copy link
Collaborator

@tmancey tmancey commented Dec 22, 2021

Resolves brave/brave-browser#20206

Submitter Checklist:

  • I confirm that no security/privacy review is needed, or that I have requested one
  • There is a ticket for my issue
  • Used Github auto-closing keywords in the PR description above
  • Wrote a good PR/commit description
  • Squashed any review feedback or "fixup" commits before merge, so that history is a record of what happened in the repo, not your PR
  • Added appropriate labels (QA/Yes or QA/No; release-notes/include or release-notes/exclude; OS/...) to the associated issue
  • Checked the PR locally: npm run test -- brave_browser_tests, npm run test -- brave_unit_tests, npm run lint, npm run gn_check, npm run tslint
  • Ran git rebase master (if needed)

Reviewer Checklist:

  • A security review is not needed, or a link to one is included in the PR description
  • New files have MPL-2.0 license header
  • Adequate test coverage exists to prevent regressions
  • Major classes, functions and non-trivial code blocks are well-commented
  • Changes in component dependencies are properly reflected in gn
  • Code follows the style guide
  • Test plan is specified in PR before merging

After-merge Checklist:

Test Plan:

Only affects 1.35 and above. Can be tested as part of brave/brave-browser#16005 or at a minimum please test the following within brave://rewards 30-day ads history:

  • Save an ad

    • Confirm ad was saved by clicking "Saved" filter
    • Confirm creative instance id was saved under client.json / adPreferences / saved_ads
  • Remove an ad from saved

    • Confirm ad was removed from "Saved" filter
    • Confirm creative instance id was removed from client.json /
      adPreferences / saved_ads
  • Mark as inappropriate (see kebab menu)

    • Confirm ads are blocked based upon the creative set id for the marked ad
    • Confirm creative set id was saved under client.json / adPreferences / flagged_ads
  • Unmark as inappropriate (see kebab menu)

    • Confirm ads are not blocked based upon the creative set id for the unmarked ad
    • Confirm creative set id was removed from client.json / adPreferences / flagged_ads
  • Mark to no longer receive (aka no entry icon)

    • Confirm ads are blocked based upon the category name for the marked ad
    • Confirm category name was saved under client.json / adPreferences / filtered_categories
  • Unmark to no longer receive (aka heart icon or neutral, i.e. no icon selected)

    • Confirm ads are not blocked based upon the category name for the unmarked ad
    • Confirm category name was removed from client.json / adPreferences / filtered_categories
  • Dislike (aka thumbs down icon)

    • Confirm ads are blocked based upon the advertiser id for the disliked ad
    • Confirm advertiser id was saved under client.json / adPreferences / filtered_advertisers
  • Like (aka thumbs up icon or neutral, i.e. no icon selected)

    • Confirm ads are not blocked based upon the advertiser id for the liked ad
    • Confirm advertiser id was removed from client.json / adPreferences / filtered_advertisers

@tmancey tmancey requested review from a team as code owners December 22, 2021 18:13
@tmancey tmancey self-assigned this Dec 22, 2021
@tmancey tmancey removed the request for review from kylehickinson December 22, 2021 18:13
Copy link
Contributor

@emerick emerick left a comment

Choose a reason for hiding this comment

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

LGTM

vendor/bat-native-ads/src/bat/ads/ad_content_info.cc Outdated Show resolved Hide resolved
@tmancey tmancey force-pushed the issues/20206 branch 2 times, most recently from cf6e35d to 89dd280 Compare December 22, 2021 18:20
@tmancey tmancey requested a review from Brandon-T December 22, 2021 18:21
@tmancey tmancey force-pushed the issues/20206 branch 4 times, most recently from 81553b0 to de53cfa Compare December 28, 2021 14:16
@tmancey tmancey requested a review from aseren December 28, 2021 23:16
@tmancey tmancey force-pushed the issues/20206 branch 3 times, most recently from a1b1b57 to bb17206 Compare December 29, 2021 00:17
@tmancey
Copy link
Collaborator Author

tmancey commented Dec 29, 2021

CI failed on macOS due to unrelated test "EphemeralStorageBrowserTest.BroadcastChannelIsPartitioned (../../brave/browser/ephemeral_storage/ephemeral_storage_browsertest.cc:921)"

@tmancey tmancey merged commit cccdc94 into master Dec 29, 2021
@tmancey tmancey deleted the issues/20206 branch December 29, 2021 10:40
@btlechowski
Copy link

Found brave/brave-browser#20482 while testing, but I think we should uplift anyway as it improves state of 1.35.x

Brave 1.36.29 Chromium: 97.0.4692.71 (Official Build) nightly (64-bit)
Revision adefa7837d02a07a604c1e6eff0b3a09422ab88d-refs/branch-heads/4692@{#1247}
OS Ubuntu 18.04 LTS

Save an ad

Confirmed ad was saved by clicking "Saved" filter
image

Confirm creative instance id was saved under config.json / adPreferences / saved_ads
image

Remove an ad from saved

Confirm ad was removed from "Saved" filter
image

Confirm creative instance id was removed from config.json / adPreferences / saved_ads
image

Mark as inappropriate (see kebab menu)

Confirm ads are blocked based upon the creative set id for the marked ad
image

[20832:20832:0113/015852.999405:VERBOSE1:eligible_ad_notifications_v1.cc(39)] Get eligible ad notifications:
[20832:20832:0113/015853.000248:VERBOSE1:eligible_ad_notifications_v1.cc(150)] Get eligible ads for untargeted segment
[20832:20832:0113/015853.001102:VERBOSE2:exclusion_rules_base.cc(123)] creativeSetId 5f8c4787-8431-49a5-9d09-bba40f8ad5f4 excluded due to being marked as inappropriate
[20832:20832:0113/015853.001228:VERBOSE1:seen_advertisers.h(30)] All ad_notification advertisers have been shown, so round robin
[20832:20832:0113/015853.001331:VERBOSE1:client.cc(446)] Resetting seen ad_notification advertisers
[20832:20832:0113/015853.001677:VERBOSE1:seen_ads.h(30)] All ad_notification ads have been shown, so round robin
[20832:20832:0113/015853.001727:VERBOSE1:client.cc(410)] Resetting seen ad_notifications
[20832:20832:0113/015853.001947:VERBOSE1:eligible_ad_notifications_v1.cc(165)] No eligible ads for untargeted segment
[20832:20832:0113/015853.002088:VERBOSE1:ad_notification_serving.cc(136)] Ad notification not served: No eligible ads found

Confirm creative set id was saved under config.json / adPreferences / flagged_ads
image

[18852:18852:0112/234903.242713:VERBOSE1:confirmations.cc(69)] Confirming flag for ad_notification with transaction id 211a5887-b518-4b42-b5eb-433e6c336a98 and creative instance id c6a6b939-4167-41fb-8a84-1edde6c12250
[18852:18852:0112/234903.244209:VERBOSE1:redeem_unblinded_token.cc(55)] Redeem unblinded token
[18852:18852:0112/234903.244930:VERBOSE1:redeem_unblinded_token.cc(74)] CreateConfirmation
[18852:18852:0112/234903.245138:VERBOSE2:redeem_unblinded_token.cc(75)] POST /v2/confirmation/{confirmation_id}/{credential}
[18852:18852:0112/234903.245309:VERBOSE6:redeem_unblinded_token.cc(79)] URL Request:
  URL: https://ads-serve.bravesoftware.com/v2/confirmation/d74cff24-f073-4d01-8996-6aaa06cb0397/eyJwYXlsb2FkIjoie1wiYmxpbmRlZFBheW1lbnRUb2tlbnNcIjpbXCJBb2hPaENIcDhRaC9wNitlRjNsSStjRm5CZjhhZkRqUFFOOXVpTUxpN204PVwiXSxcImJ1aWxkQ2hhbm5lbFwiOlwibmlnaHRseVwiLFwiY3JlYXRpdmVJbnN0YW5jZUlkXCI6XCJjNmE2YjkzOS00MTY3LTQxZmItOGE4NC0xZWRkZTZjMTIyNTBcIixcInBheWxvYWRcIjp7fSxcInBsYXRmb3JtXCI6XCJsaW51eFwiLFwicHVibGljS2V5XCI6XCJpTWhSSGY5MnEyM05ueUpKTnBleVZ0S2JTaUNSRkxtS1g3UFE1bHJmaWs4PVwiLFwic3R1ZGllc1wiOltdLFwidHlwZVwiOlwiZmxhZ1wifSIsInNpZ25hdHVyZSI6IjZ0Yi9iNW1vc1A5L0oyalRadTBGQnByQ3F2SnJPMkVHWkFiUnVYalRzdE1LMlZqRlB3LzBMUU8zenlHcjRlUkhUZHRiZHZFUE9IOGQxN2g1U1FwUSt3PT0iLCJ0IjoiQU1xNDBCSjVGYkxKMHRBUnU0VWJqOENwbDhMcHQwc2pmVktPTEZ2cStOaXJBQk9QSUJDd1J6dm1PajdVKzhieThuR0t3aE8xSWI1ZndxWm9DbjhadkE9PSJ9
  Content: {"blindedPaymentTokens":["AohOhCHp8Qh/p6+eF3lI+cFnBf8afDjPQN9uiMLi7m8="],"buildChannel":"nightly","creativeInstanceId":"c6a6b939-4167-41fb-8a84-1edde6c12250","payload":{},"platform":"linux","publicKey":"iMhRHf92q23NnyJJNpeyVtKbSiCRFLmKX7PQ5lrfik8=","studies":[],"type":"flag"}
  Content Type: application/json
  Method: kPost
[18852:18852:0112/234903.496332:VERBOSE1:redeem_unblinded_token.cc(90)] OnCreateConfirmation
[18852:18852:0112/234903.496366:VERBOSE6:redeem_unblinded_token.cc(92)] URL Response:
  URL: https://ads-serve.bravesoftware.com/v2/confirmation/d74cff24-f073-4d01-8996-6aaa06cb0397/eyJwYXlsb2FkIjoie1wiYmxpbmRlZFBheW1lbnRUb2tlbnNcIjpbXCJBb2hPaENIcDhRaC9wNitlRjNsSStjRm5CZjhhZkRqUFFOOXVpTUxpN204PVwiXSxcImJ1aWxkQ2hhbm5lbFwiOlwibmlnaHRseVwiLFwiY3JlYXRpdmVJbnN0YW5jZUlkXCI6XCJjNmE2YjkzOS00MTY3LTQxZmItOGE4NC0xZWRkZTZjMTIyNTBcIixcInBheWxvYWRcIjp7fSxcInBsYXRmb3JtXCI6XCJsaW51eFwiLFwicHVibGljS2V5XCI6XCJpTWhSSGY5MnEyM05ueUpKTnBleVZ0S2JTaUNSRkxtS1g3UFE1bHJmaWs4PVwiLFwic3R1ZGllc1wiOltdLFwidHlwZVwiOlwiZmxhZ1wifSIsInNpZ25hdHVyZSI6IjZ0Yi9iNW1vc1A5L0oyalRadTBGQnByQ3F2SnJPMkVHWkFiUnVYalRzdE1LMlZqRlB3LzBMUU8zenlHcjRlUkhUZHRiZHZFUE9IOGQxN2g1U1FwUSt3PT0iLCJ0IjoiQU1xNDBCSjVGYkxKMHRBUnU0VWJqOENwbDhMcHQwc2pmVktPTEZ2cStOaXJBQk9QSUJDd1J6dm1PajdVKzhieThuR0t3aE8xSWI1ZndxWm9DbjhadkE9PSJ9
  Response Status Code: 201
  Response: {"id":"d74cff24-f073-4d01-8996-6aaa06cb0397","payload":{},"createdAt":"2022-01-12T22:49:03.263Z","type":"flag","modifiedAt":"2022-01-12T22:49:03.263Z","creativeInstanceId":"c6a6b939-4167-41fb-8a84-1edde6c12250"}
[18852:18852:0112/234903.496402:VERBOSE1:redeem_unblinded_token.cc(118)] FetchPaymentToken
[18852:18852:0112/234903.496425:VERBOSE2:redeem_unblinded_token.cc(119)] GET /v2/confirmation/{confirmation_id}/paymentToken
[18852:18852:0112/234903.496440:VERBOSE6:redeem_unblinded_token.cc(123)] URL Request:
  URL: https://ads-serve.bravesoftware.com/v2/confirmation/d74cff24-f073-4d01-8996-6aaa06cb0397/paymentToken
  Method: kGet
[18852:18852:0112/234903.761781:VERBOSE1:redeem_unblinded_token.cc(134)] OnFetchPaymentToken
[18852:18852:0112/234903.762098:VERBOSE6:redeem_unblinded_token.cc(136)] URL Response:
  URL: https://ads-serve.bravesoftware.com/v2/confirmation/d74cff24-f073-4d01-8996-6aaa06cb0397/paymentToken
  Response Status Code: 202
  Response: {"error":"Payment Tokens are not ready","statusCode":202}
[18852:18852:0112/234903.762347:VERBOSE1:redeem_unblinded_token.cc(162)] Payment token is not ready
[18852:18852:0112/234903.762437:VERBOSE1:confirmations.cc(301)] Failed to redeem unblinded token for ad_notification with confirmation id d74cff24-f073-4d01-8996-6aaa06cb0397, transaction id 211a5887-b518-4b42-b5eb-433e6c336a98, creative instance id c6a6b939-4167-41fb-8a84-1edde6c12250 and flag
[18852:18852:0112/234903.762855:VERBOSE1:confirmations.cc(213)] Added flag confirmation for ad_notification with id d74cff24-f073-4d01-8996-6aaa06cb0397, transaction id211a5887-b518-4b42-b5eb-433e6c336a98 and creative instance id c6a6b939-4167-41fb-8a84-1edde6c12250 to the confirmations queue
[18852:18852:0112/234903.763982:VERBOSE1:refill_unblinded_tokens.cc(84)] No need to refill unblinded tokens as we already have 47 unblinded tokens which is above the minimum threshold of 20
[18852:18852:0112/234940.143267:VERBOSE1:confirmations.cc(237)] Removed view confirmation for ad_notification with id 67afb687-24c1-480a-b70e-18776f1c273c, transaction id 5c332928-59ff-4a32-8b27-7b75fb2b9075 and creative instance id c6a6b939-4167-41fb-8a84-1edde6c12250 from the confirmations queue
[18852:18852:0112/234940.143955:VERBOSE1:redeem_unblinded_token.cc(55)] Redeem unblinded token
[18852:18852:0112/234940.144872:VERBOSE1:redeem_unblinded_token.cc(118)] FetchPaymentToken
[18852:18852:0112/234940.145010:VERBOSE2:redeem_unblinded_token.cc(119)] GET /v2/confirmation/{confirmation_id}/paymentToken
[18852:18852:0112/234940.145038:VERBOSE6:redeem_unblinded_token.cc(123)] URL Request:
  URL: https://ads-serve.bravesoftware.com/v2/confirmation/67afb687-24c1-480a-b70e-18776f1c273c/paymentToken
  Method: kGet
[18852:18852:0112/234940.380849:VERBOSE1:redeem_unblinded_token.cc(134)] OnFetchPaymentToken
[18852:18852:0112/234940.380893:VERBOSE6:redeem_unblinded_token.cc(136)] URL Response:
  URL: https://ads-serve.bravesoftware.com/v2/confirmation/67afb687-24c1-480a-b70e-18776f1c273c/paymentToken
  Response Status Code: 200
  Response: {"id":"67afb687-24c1-480a-b70e-18776f1c273c","createdAt":"2022-01-12T22:48:44.644Z","type":"view","modifiedAt":"2022-01-12T22:48:44.644Z","creativeInstanceId":"c6a6b939-4167-41fb-8a84-1edde6c12250","paymentToken":{"publicKey":"GOB6LeHg+z3Li9T5nWPdbVpGPLZ3mQm25h/KnPPIpEI=","batchProof":"qFSEdZnHKw2HtZubKAnStL/QAxGnioDu1FE76VmX+A+9CwDjqHtxiZYBQ1EKdX+AiZmFGRCmx4Hk+vOlWhIeDw==","signedTokens":["RBffjMN3TThYCK1KXt+puKIgNJV0DWfFDZE1TGkw1Ew="]}}
[18852:18852:0112/234940.383757:VERBOSE1:confirmations.cc(284)] Successfully redeemed unblinded token for ad_notification with confirmation id 67afb687-24c1-480a-b70e-18776f1c273c, transaction id 5c332928-59ff-4a32-8b27-7b75fb2b9075, creative instance id c6a6b939-4167-41fb-8a84-1edde6c12250 and view. You now have 1 unblinded payment tokens which will be redeemed in 0 hours, 13 minutes, 36 seconds at 12:03 AM

Unmark as inappropriate (see kebab menu)

Confirm ads are not blocked based upon the creative set id for the unmarked ad
image

[20832:20832:0113/020034.691368:VERBOSE1:eligible_ad_notifications_v1.cc(39)] Get eligible ad notifications:
[20832:20832:0113/020034.692161:VERBOSE1:eligible_ad_notifications_v1.cc(150)] Get eligible ads for untargeted segment
[20832:20832:0113/020034.693390:VERBOSE1:seen_advertisers.h(30)] All ad_notification advertisers have been shown, so round robin
[20832:20832:0113/020034.693462:VERBOSE1:client.cc(446)] Resetting seen ad_notification advertisers
[20832:20832:0113/020034.693539:VERBOSE1:seen_ads.h(30)] All ad_notification ads have been shown, so round robin
[20832:20832:0113/020034.693593:VERBOSE1:client.cc(410)] Resetting seen ad_notifications
[20832:20832:0113/020034.693661:VERBOSE2:ad_priority.h(32)] 1 ads with a priority of 1 in bucket 1
[20832:20832:0113/020034.694239:VERBOSE1:ad_notification_serving.cc(141)] Found 1 eligible ads
[20832:20832:0113/020034.694304:VERBOSE1:ad_notification_serving.cc(260)] Serving ad notification:
  uuid: 3ceca787-a2e7-48cc-8bb4-65c0f6e8e4e1
  creativeInstanceId: 4cda3ae7-1f70-4bca-b361-ca01d6a8f1ed
  creativeSetId: 5f8c4787-8431-49a5-9d09-bba40f8ad5f4
  campaignId: d1e25388-b362-4f30-bd4b-36b8205e59e5
  advertiserId: a34de75d-5654-4331-8713-8f4d4e2b6bf7
  segment: untargeted
  title: Vivamus sagittis lacus vel aug
  body: Duis mollis, est non commodo luctus, nisi erat porttitor lig
  targetUrl: https://www.apple.com

Confirm creative set id was removed from config.json / adPreferences / flagged_ads
image

Mark to no longer receive (aka no entry icon)

Confirm ads are blocked based upon the category name for the marked ad
image

Failed. Ad is shown and config.json / adPreferences / filtered_categories is empty. Logged brave/brave-browser#20482

Confirm category name was saved under config.json / adPreferences / filtered_categories
image

Unmark to no longer receive (aka heart icon or neutral, i.e. no icon selected)

Blocked on brave/brave-browser#20482

Confirm ads are not blocked based upon the category name for the unmarked ad

Confirm category name was removed from config.json / adPreferences / filtered_categories

Dislike (aka thumbs down icon)

FAIL: brave/brave-browser#20482 (comment)

Confirm ads are blocked based upon the advertiser id for the disliked ad

image

Confirm advertiser id was saved under config.json / adPreferences / filtered_advertisers

"filtered_advertisers":[{"id":"a34de75d-5654-4331-8713-8f4d4e2b6bf7"}]

Like (aka thumbs up icon or neutral, i.e. no icon selected)

Confirm ads are not blocked based upon the advertiser id for the liked ad
image

Ad was shown:

[29874:29874:0113/102112.968419:VERBOSE1:eligible_ad_notifications_v1.cc(39)] Get eligible ad notifications:
[29874:29874:0113/102112.969400:VERBOSE1:eligible_ad_notifications_v1.cc(150)] Get eligible ads for untargeted segment
[29874:29874:0113/102112.971101:VERBOSE1:seen_advertisers.h(30)] All ad_notification advertisers have been shown, so round robin
[29874:29874:0113/102112.971308:VERBOSE1:client.cc(446)] Resetting seen ad_notification advertisers
[29874:29874:0113/102112.971461:VERBOSE1:seen_ads.h(30)] All ad_notification ads have been shown, so round robin
[29874:29874:0113/102112.971549:VERBOSE1:client.cc(410)] Resetting seen ad_notifications
[29874:29874:0113/102112.971673:VERBOSE2:ad_priority.h(32)] 1 ads with a priority of 1 in bucket 1
[29874:29874:0113/102112.971891:VERBOSE1:ad_notification_serving.cc(141)] Found 1 eligible ads
[29874:29874:0113/102112.971982:VERBOSE1:ad_notification_serving.cc(260)] Serving ad notification:
  uuid: ac3e41b9-d76f-4d8d-8745-3fa62b2d0ce2
  creativeInstanceId: 4cda3ae7-1f70-4bca-b361-ca01d6a8f1ed
  creativeSetId: 5f8c4787-8431-49a5-9d09-bba40f8ad5f4
  campaignId: d1e25388-b362-4f30-bd4b-36b8205e59e5
  advertiserId: a34de75d-5654-4331-8713-8f4d4e2b6bf7
  segment: untargeted
  title: Vivamus sagittis lacus vel aug
  body: Duis mollis, est non commodo luctus, nisi erat porttito

Confirm advertiser id was removed from config.json / adPreferences / filtered_advertisers

"filtered_advertisers":[]

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.

Fix Brave Ads save and dislike filters
5 participants