-
Notifications
You must be signed in to change notification settings - Fork 972
Add separate worker for scam, so it can handle RC updates immediately #5857
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
Conversation
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
d18103b
to
68dccd5
Compare
01ccafb
to
f8bc86b
Compare
68dccd5
to
4e93bfa
Compare
f8bc86b
to
9ed1aca
Compare
7af243e
to
f160884
Compare
9ed1aca
to
c5faa7e
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.
LGTM just left some comments for readability
|
||
val feeds = inputData.getStringArray(TYPE) | ||
?.mapNotNull { Feed.fromString(it) } | ||
?.filter { it != SCAM || maliciousSiteProtectionFeature.scamProtectionEnabled() } |
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.
I find it != SCAM || maliciousSiteProtectionFeature.scamProtectionEnabled()
difficult to read / process, I understand you want to remove scam as feed unless they feature flag is enabled, but it took me some time. I feel it's not clear how the 2 checks are connected.
what about something as:
val feeds = inputData.getStringArray(TYPE)
?.mapNotNull { Feed.fromString(it) }
?.let { feeds ->
if (!maliciousSiteProtectionFeature.scamProtectionEnabled()) {
feeds.filterNot { it == SCAM }
}
feeds
}
...in/com/duckduckgo/malicioussiteprotection/impl/MaliciousSiteProtectionFiltersUpdateWorker.kt
Show resolved
Hide resolved
|
||
val feeds = inputData.getStringArray(TYPE) | ||
?.mapNotNull { Feed.fromString(it) } | ||
?.filter { it != SCAM || maliciousSiteProtectionFeature.scamProtectionEnabled() } |
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.
ditto
return loadDataOfType(FILTER_SET) { latestRevision, networkRevision, feed -> loadFilters(latestRevision, networkRevision, feed) } | ||
override suspend fun loadFilters(vararg feeds: Feed): Result<Unit> { | ||
return loadDataOfType(FILTER_SET) { | ||
latestRevision, networkRevision -> |
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.
Can we use localRevisions
instead of latestRevision
? Just to have consistency with localRevisions = getLocalRevisions(type)
return loadDataOfType(HASH_PREFIXES) { latestRevision, networkRevision, feed -> loadHashPrefixes(latestRevision, networkRevision, feed) } | ||
override suspend fun loadHashPrefixes(vararg feeds: Feed): Result<Unit> { | ||
return loadDataOfType(HASH_PREFIXES) { | ||
latestRevision, networkRevision -> |
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.
ditto
f160884
to
4a0805e
Compare
c5faa7e
to
91ff0e9
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.
LGTM!
b89d6bf
into
feature/cris/scam-protection/add-support-for-scam-protection
Task/Issue URL: https://app.asana.com/0/0/1209893469792815/f
Description
Steps to test this PR
Feature 1
revisions
table inmalicious_sites
dbFeature 2
scamProtection
under Feature Flag Inventory and restart the apprevisions
table inmalicious_sites
dbscamProtection
under Feature Flag Inventory and restart the appUI changes