Skip to content

Commit 1ebfe1c

Browse files
committed
mentions search: don't search for blacklisted domains. for #456, #490
1 parent 5b8dbf6 commit 1ebfe1c

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

tasks.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,8 @@ def poll(self, source):
150150
#
151151
# https://dev.twitter.com/rest/public/search
152152
# https://developers.google.com/+/api/latest/activities/search
153-
query = ' OR '.join('"%s"' % domain for domain in source.domains)
153+
query = ' OR '.join('"%s"' % domain for domain in source.domains
154+
if not util.in_webmention_blacklist(domain))
154155
mentions = source.get_activities_response(
155156
search_query=query, group_id=gr_source.SEARCH, **kwargs
156157
).get('items', [])

test/test_tasks.py

+7
Original file line numberDiff line numberDiff line change
@@ -555,6 +555,13 @@ def test_search_for_mentions_skips_redirected_posse_post(self):
555555
original_posts=['http://or.ig/post'],
556556
)])
557557

558+
def test_search_for_mentions_skips_blacklisted_domains(self):
559+
"""https://github.com/snarfed/bridgy/issues/490"""
560+
self.sources[0].domains = ['good', 't.co']
561+
self.sources[0].put()
562+
self.post_task()
563+
self.assertEquals('"good"', self.sources[0].last_search_query)
564+
558565
def test_wrong_last_polled(self):
559566
"""If the source doesn't have our last polled value, we should quit.
560567
"""

0 commit comments

Comments
 (0)