kopia lustrzana https://github.com/snarfed/bridgy-fed
add manual opt-out list
rodzic
6225fa8884
commit
aaf115347e
|
@ -7,6 +7,7 @@ datastore.dat*
|
|||
flask_secret_key
|
||||
/l
|
||||
/local*
|
||||
opt_outs.txt
|
||||
private_notes
|
||||
service_account_creds.json
|
||||
TAGS
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
import base64
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
import threading
|
||||
import urllib.parse
|
||||
|
@ -64,6 +65,9 @@ DOMAIN_BLOCKLIST = (
|
|||
'twitter.com',
|
||||
)
|
||||
|
||||
with open(os.path.join(os.path.dirname(__file__), 'opt_outs.txt')) as f:
|
||||
OPT_OUT_IDS = util.load_file_lines(f)
|
||||
|
||||
# populated in models.reset_protocol_properties
|
||||
SUBDOMAIN_BASE_URL_RE = None
|
||||
ID_FIELDS = ['id', 'object', 'actor', 'author', 'inReplyTo', 'url']
|
||||
|
|
|
@ -310,6 +310,9 @@ class User(StringIdModel, metaclass=ProtocolUserMeta):
|
|||
|
||||
https://github.com/snarfed/bridgy-fed/issues/666
|
||||
"""
|
||||
if self.key.id() in common.OPT_OUT_IDS:
|
||||
return 'opt-out'
|
||||
|
||||
if not self.obj or not self.obj.as1:
|
||||
return None
|
||||
|
||||
|
|
|
@ -235,6 +235,10 @@ class UserTest(TestCase):
|
|||
})
|
||||
self.assertEqual('opt-out', user.status)
|
||||
|
||||
# from opt_outs.txt
|
||||
user = self.make_user('fake:bridgy-fed:test-opt-out', cls=Fake)
|
||||
self.assertEqual('opt-out', user.status)
|
||||
|
||||
def test_get_copy(self):
|
||||
user = Fake(id='x')
|
||||
self.assertEqual('x', user.get_copy(Fake))
|
||||
|
|
Ładowanie…
Reference in New Issue