kopia lustrzana https://github.com/snarfed/bridgy-fed
switch from opt_outs.txt to new User.manual_opt_out property
opt_outs.txt wasn't included in continuous deploy from Circle, so those deploys were ignoring ids in that file :/pull/785/head
rodzic
b6989a4f2e
commit
4529f30dce
|
@ -8,7 +8,6 @@ flask_secret_key
|
|||
/l
|
||||
/local*
|
||||
make_password
|
||||
opt_outs.txt
|
||||
private_notes
|
||||
service_account_creds.json
|
||||
superfeedr_token
|
||||
|
|
|
@ -66,13 +66,6 @@ DOMAIN_BLOCKLIST = (
|
|||
'twitter.com',
|
||||
)
|
||||
|
||||
opt_outs = Path(__file__).parent / 'opt_outs.txt'
|
||||
if opt_outs.exists():
|
||||
with opt_outs.open() as f:
|
||||
OPT_OUT_IDS = util.load_file_lines(f)
|
||||
else:
|
||||
OPT_OUT_IDS = {'fake:bridgy-fed:test-opt-out'}
|
||||
|
||||
# populated in models.reset_protocol_properties
|
||||
SUBDOMAIN_BASE_URL_RE = None
|
||||
ID_FIELDS = ['id', 'object', 'actor', 'author', 'inReplyTo', 'url']
|
||||
|
|
|
@ -152,6 +152,10 @@ class User(StringIdModel, metaclass=ProtocolUserMeta):
|
|||
public_exponent = ndb.StringProperty()
|
||||
private_exponent = ndb.StringProperty()
|
||||
|
||||
# set to True for users who asked me to be opted out instead of putting
|
||||
# #nobridge in their profile
|
||||
manual_opt_out = ndb.BooleanProperty()
|
||||
|
||||
created = ndb.DateTimeProperty(auto_now_add=True)
|
||||
updated = ndb.DateTimeProperty(auto_now=True)
|
||||
|
||||
|
@ -314,7 +318,7 @@ class User(StringIdModel, metaclass=ProtocolUserMeta):
|
|||
|
||||
https://github.com/snarfed/bridgy-fed/issues/666
|
||||
"""
|
||||
if self.key.id() in common.OPT_OUT_IDS:
|
||||
if self.manual_opt_out:
|
||||
return 'opt-out'
|
||||
|
||||
if not self.obj or not self.obj.as1:
|
||||
|
|
|
@ -233,8 +233,7 @@ 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)
|
||||
user = User(manual_opt_out=True)
|
||||
self.assertEqual('opt-out', user.status)
|
||||
|
||||
def test_get_copy(self):
|
||||
|
|
Ładowanie…
Reference in New Issue