prevent past unfollows from removing an instance

This commit is contained in:
Izalia Mae 2024-02-14 15:33:01 -05:00
parent 70617fbdf6
commit b86159c7ae

View file

@ -102,7 +102,6 @@ async def handle_follow(view: ActorView, conn: Connection) -> None:
view.instance = conn.update_inbox(view.actor.shared_inbox, followid = view.message.id) view.instance = conn.update_inbox(view.actor.shared_inbox, followid = view.message.id)
else: else:
with conn.transaction():
view.instance = conn.put_inbox( view.instance = conn.put_inbox(
view.actor.domain, view.actor.domain,
view.actor.shared_inbox, view.actor.shared_inbox,
@ -141,7 +140,10 @@ async def handle_undo(view: ActorView, conn: Connection) -> None:
await handle_forward(view, conn) await handle_forward(view, conn)
return return
with conn.transaction(): # prevent past unfollows from removing an instance
if view.instance['followid'] and view.instance['followid'] != view.message.object_id:
return
if not conn.del_inbox(view.actor.id): if not conn.del_inbox(view.actor.id):
logging.verbose( logging.verbose(
'Failed to delete "%s" with follow ID "%s"', 'Failed to delete "%s" with follow ID "%s"',