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,14 +102,13 @@ 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, view.actor.id,
view.actor.id, view.message.id,
view.message.id, software
software )
)
view.app.push_message( view.app.push_message(
view.actor.shared_inbox, view.actor.shared_inbox,
@ -141,13 +140,16 @@ 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 not conn.del_inbox(view.actor.id): if view.instance['followid'] and view.instance['followid'] != view.message.object_id:
logging.verbose( return
'Failed to delete "%s" with follow ID "%s"',
view.actor.id, if not conn.del_inbox(view.actor.id):
view.message.object['id'] logging.verbose(
) 'Failed to delete "%s" with follow ID "%s"',
view.actor.id,
view.message.object['id']
)
view.app.push_message( view.app.push_message(
view.actor.shared_inbox, view.actor.shared_inbox,