From 3d81e5ef68b95b482537950f220b6e2cca973b42 Mon Sep 17 00:00:00 2001 From: Izalia Mae Date: Thu, 1 Feb 2024 21:40:27 -0500 Subject: [PATCH] pass instance row to HttpClient.post --- relay/manage.py | 4 ++-- relay/processors.py | 17 ++++++++--------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/relay/manage.py b/relay/manage.py index 307140f..6872026 100644 --- a/relay/manage.py +++ b/relay/manage.py @@ -414,7 +414,7 @@ def cli_inbox_follow(ctx: click.Context, actor: str) -> None: actor = actor ) - asyncio.run(http.post(inbox, message)) + asyncio.run(http.post(inbox, message, None, inbox_data)) click.echo(f'Sent follow message to actor: {actor}') @@ -455,7 +455,7 @@ def cli_inbox_unfollow(ctx: click.Context, actor: str) -> None: } ) - asyncio.run(http.post(inbox, message)) + asyncio.run(http.post(inbox, message, inbox_data)) click.echo(f'Sent unfollow message to: {actor}') diff --git a/relay/processors.py b/relay/processors.py index 671adb3..36ece44 100644 --- a/relay/processors.py +++ b/relay/processors.py @@ -100,14 +100,10 @@ async def handle_follow(view: ActorView) -> None: return if conn.get_inbox(view.actor.shared_inbox): - data = {'followid': view.message.id} - statement = tinysql.Update('inboxes', data, inbox = view.actor.shared_inbox) - - with conn.query(statement): - pass + view.instance = conn.update_inbox(view.actor.shared_inbox, followid = view.message.id) else: - conn.put_inbox( + view.instance = conn.put_inbox( view.actor.domain, view.actor.shared_inbox, view.actor.id, @@ -122,7 +118,8 @@ async def handle_follow(view: ActorView) -> None: actor = view.actor.id, followid = view.message.id, accept = True - ) + ), + view.instance ) # Are Akkoma and Pleroma the only two that expect a follow back? @@ -133,7 +130,8 @@ async def handle_follow(view: ActorView) -> None: Message.new_follow( host = view.config.domain, actor = view.actor.id - ) + ), + view.instance ) @@ -157,7 +155,8 @@ async def handle_undo(view: ActorView) -> None: host = view.config.domain, actor = view.actor.id, follow = view.message - ) + ), + view.instance )