Attempting to get the visibility tests passing. Not there yet.

2019-08-17
Marnanel Thurman 2019-07-11 17:24:22 +01:00
rodzic 11b187c71f
commit b6697c81c6
1 zmienionych plików z 18 dodań i 1 usunięć

Wyświetl plik

@ -20,13 +20,30 @@ class Item(thing.Thing):
@property
def visibility(self):
from django_kepi.find import find
audiences = audience.Audience.get_audiences_for(self)
logger.debug('%s', str(audiences))
logger.debug('%s: checking visibility in audiences: %s',
self.number, str(audiences))
if audience.PUBLIC in audiences.get('to', []):
return 'public'
elif audience.PUBLIC in audiences.get('cc', []):
return 'unlisted'
actor = find(self.account, local_only=True)
if actor is None:
logger.debug('%s: posted by %s, whom we don\'t know about',
self.number, self.account)
else:
logger.debug('%s: checking visibility from poster: %s',
self.number, actor)
if actor['following'] in audiences.get('to', []):
return 'private'
return 'direct'
@property