From 859edac084a8d2f2740c64b832f29fad1a3257a3 Mon Sep 17 00:00:00 2001 From: Alan Roberts Date: Fri, 13 Sep 2024 11:34:14 -0400 Subject: [PATCH] passing user.id rather than the user directly --- app/admin/routes.py | 4 ++-- app/community/routes.py | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/admin/routes.py b/app/admin/routes.py index c5a21fb6..59e2585e 100644 --- a/app/admin/routes.py +++ b/app/admin/routes.py @@ -291,10 +291,10 @@ def admin_federation(): # capture the messages returned by do_subscibe # and show to user if instance is in debug mode if current_app.debug: - message = do_subscribe(new_community.ap_id, user, main_user_name=False) + message = do_subscribe(new_community.ap_id, user.id, main_user_name=False) pre_load_messages.append(message) else: - message_we_wont_do_anything_with = do_subscribe.delay(new_community.ap_id, user, main_user_name=False) + message_we_wont_do_anything_with = do_subscribe.delay(new_community.ap_id, user.id, main_user_name=False) if current_app.debug: flash(_(f'Results: {pre_load_messages}')) diff --git a/app/community/routes.py b/app/community/routes.py index 55cd56b8..e560abd9 100644 --- a/app/community/routes.py +++ b/app/community/routes.py @@ -390,14 +390,15 @@ def show_community_rss(actor): @login_required @validation_required def subscribe(actor): - do_subscribe(actor, current_user) + do_subscribe(actor, current_user.id) # this is separated out from the route, so it can be used by the # admin.admin_federation.preload_form as well @celery.task -def do_subscribe(actor, user, main_user_name=True): +def do_subscribe(actor, user_id, main_user_name=True): remote = False actor = actor.strip() + user = User.query.get(user_id) pre_load_message = {} if '@' in actor: community = Community.query.filter_by(banned=False, ap_id=actor).first()