Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: sitescripts/reports/bin/mailDigests.py

Issue 29664601: Issue 6212 - Don't create reports for type "other" (Closed) Base URL: https://hg.adblockplus.org/sitescripts/file/cd6f20a3aede
Patch Set: Created Jan. 12, 2018, 11:58 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # This file is part of the Adblock Plus web scripts, 1 # This file is part of the Adblock Plus web scripts,
2 # Copyright (C) 2006-present eyeo GmbH 2 # Copyright (C) 2006-present eyeo GmbH
3 # 3 #
4 # Adblock Plus is free software: you can redistribute it and/or modify 4 # Adblock Plus is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License version 3 as 5 # it under the terms of the GNU General Public License version 3 as
6 # published by the Free Software Foundation. 6 # published by the Free Software Foundation.
7 # 7 #
8 # Adblock Plus is distributed in the hope that it will be useful, 8 # Adblock Plus is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 if dbreport['type'] == 'false positive' or dbreport['type'] == 'false ne gative': 61 if dbreport['type'] == 'false positive' or dbreport['type'] == 'false ne gative':
62 for subscription in reportSubscriptions: 62 for subscription in reportSubscriptions:
63 subscriptionID = subscription.get('url', 'unknown') 63 subscriptionID = subscription.get('url', 'unknown')
64 if subscriptionID in subscriptions: 64 if subscriptionID in subscriptions:
65 if subscription.get('hasmatches', 0) > 0: 65 if subscription.get('hasmatches', 0) > 0:
66 matchSubscriptions[subscriptionID] = subscriptions[subsc riptionID] 66 matchSubscriptions[subscriptionID] = subscriptions[subsc riptionID]
67 # Send false negatives to all subscription authors, false po sitives 67 # Send false negatives to all subscription authors, false po sitives
68 # only to subscriptions with matching filters 68 # only to subscriptions with matching filters
69 if dbreport['type'] == 'false negative' or subscription.get( 'hasmatches', 0) > 0: 69 if dbreport['type'] == 'false negative' or subscription.get( 'hasmatches', 0) > 0:
70 recipients.append(subscriptions[subscriptionID]) 70 recipients.append(subscriptions[subscriptionID])
71 elif interval != 'week':
72 # Send type "other" to fake subscription - daily reports
73 recipients.append(fakeSubscription)
74 subscriptionID = fakeSubscription.get('url', 'unknown')
75 71
76 if len(recipients) == 0: 72 if len(recipients) == 0:
77 continue 73 continue
78 74
79 report = { 75 report = {
80 'url': get_config().get('reports', 'urlRoot') + dbreport['guid'] + ' #secret=' + calculateReportSecret(dbreport['guid']), 76 'url': get_config().get('reports', 'urlRoot') + dbreport['guid'] + ' #secret=' + calculateReportSecret(dbreport['guid']),
81 'weight': calculateReportWeight(dbreport, reportSubscriptions), 77 'weight': calculateReportWeight(dbreport, reportSubscriptions),
82 'site': dbreport['site'], 78 'site': dbreport['site'],
83 'subscriptions': recipients, 79 'subscriptions': recipients,
84 'comment': re.sub(r'[\x00-\x20]', r' ', dbreport['comment']) if dbre port['comment'] != None else '', 80 'comment': re.sub(r'[\x00-\x20]', r' ', dbreport['comment']) if dbre port['comment'] != None else '',
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 if interval == 'week': 181 if interval == 'week':
186 startTime = currentTime - 7 * 24 * 60 * 60 182 startTime = currentTime - 7 * 24 * 60 * 60
187 elif interval == 'day': 183 elif interval == 'day':
188 startTime = currentTime - 24 * 60 * 60 184 startTime = currentTime - 24 * 60 * 60
189 185
190 fakeSubscription = {'url': 'https://fake.adblockplus.org', 'name': get_confi g().get('reports', 'defaultSubscriptionName'), 'email': get_config().get('report s', 'defaultSubscriptionRecipient')} 186 fakeSubscription = {'url': 'https://fake.adblockplus.org', 'name': get_confi g().get('reports', 'defaultSubscriptionName'), 'email': get_config().get('report s', 'defaultSubscriptionRecipient')}
191 subscriptions, subscriptionList = loadSubscriptions() 187 subscriptions, subscriptionList = loadSubscriptions()
192 subscriptionList.append(fakeSubscription) 188 subscriptionList.append(fakeSubscription)
193 reports = scanReports() 189 reports = scanReports()
194 sendNotifications(reports) 190 sendNotifications(reports)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld