kopia lustrzana https://github.com/snarfed/bridgy-fed
don't show protocol bot users in their own protocols
rodzic
d6a10b4be0
commit
3d84dc4d36
|
@ -179,6 +179,10 @@ class Protocol:
|
||||||
user_id = user
|
user_id = user
|
||||||
user = from_cls.get_by_id(user_id, allow_opt_out=True)
|
user = from_cls.get_by_id(user_id, allow_opt_out=True)
|
||||||
|
|
||||||
|
if from_label == 'web':
|
||||||
|
if bot_protocol := Protocol.for_bridgy_subdomain(user_id):
|
||||||
|
return to_cls != bot_protocol
|
||||||
|
|
||||||
if user:
|
if user:
|
||||||
if user.status == 'opt-out':
|
if user.status == 'opt-out':
|
||||||
return False
|
return False
|
||||||
|
|
|
@ -210,6 +210,18 @@ class ProtocolTest(TestCase):
|
||||||
user.put()
|
user.put()
|
||||||
self.assertTrue(ExplicitEnableFake.is_enabled_to(Fake, 'eefake:foo'))
|
self.assertTrue(ExplicitEnableFake.is_enabled_to(Fake, 'eefake:foo'))
|
||||||
|
|
||||||
|
def test_is_enabled_to_protocol_bot_users(self):
|
||||||
|
# protocol bot users should always be enabled to *other* protocols
|
||||||
|
self.assertTrue(Web.is_enabled_to(Fake, 'eefake.brid.gy'))
|
||||||
|
self.assertTrue(Web.is_enabled_to(ExplicitEnableFake, 'fa.brid.gy'))
|
||||||
|
self.assertTrue(Web.is_enabled_to(Fake, 'other.brid.gy'))
|
||||||
|
self.assertTrue(Web.is_enabled_to(ATProto, 'ap.brid.gy'))
|
||||||
|
self.assertTrue(Web.is_enabled_to(ActivityPub, 'bsky.brid.gy'))
|
||||||
|
|
||||||
|
# ...but not to their own protocol
|
||||||
|
self.assertFalse(Web.is_enabled_to(ActivityPub, 'ap.brid.gy'))
|
||||||
|
self.assertFalse(Web.is_enabled_to(ATProto, 'bsky.brid.gy'))
|
||||||
|
|
||||||
def test_load(self):
|
def test_load(self):
|
||||||
Fake.fetchable['foo'] = {'x': 'y'}
|
Fake.fetchable['foo'] = {'x': 'y'}
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue