Improve actor-level blocking

This commit is contained in:
Thomas Sileo 2022-08-15 10:50:13 +02:00
parent 4f98ff6bbf
commit d381bb3fec
2 changed files with 29 additions and 23 deletions

View file

@ -1219,6 +1219,7 @@ async def _handle_read_activity(
wrapped_object_actor = await fetch_actor(
db_session, ap.get_actor_id(wrapped_object)
)
if not wrapped_object_actor.is_blocked:
ro = RemoteObject(wrapped_object, actor=wrapped_object_actor)
# Then process it likes it's coming from a forwarded activity
@ -1666,7 +1667,10 @@ async def save_to_inbox(
announced_actor = await fetch_actor(
db_session, ap.get_actor_id(announced_raw_object)
)
announced_object = RemoteObject(announced_raw_object, announced_actor)
if not announced_actor.is_blocked:
announced_object = RemoteObject(
announced_raw_object, announced_actor
)
announced_inbox_object = models.InboxObject(
server=urlparse(announced_object.ap_id).hostname,
actor_id=announced_actor.id,

View file

@ -76,6 +76,8 @@ _RESIZED_CACHE: MutableMapping[tuple[str, int], tuple[bytes, str, Any]] = LFUCac
# TODO(ts):
#
# Next:
# - support Move
# - support actor delete
# - allow to share old notes
# - allow to interact with object not in anybox (i.e. like from a lookup)
# - only show 10 most recent threads in DMs