From 55d47168ce04bbad4be8fc4a879e1a6b491bc209 Mon Sep 17 00:00:00 2001 From: freamon Date: Tue, 15 Oct 2024 02:00:35 +0000 Subject: [PATCH] Use original follow id to unsubscribe from a.gup.pe groups (doesn't properly unsubscribe if gibberish is used) --- app/community/routes.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/community/routes.py b/app/community/routes.py index ba80efe8..01415089 100644 --- a/app/community/routes.py +++ b/app/community/routes.py @@ -499,13 +499,18 @@ def unsubscribe(actor): if '@' in actor: # this is a remote community, so activitypub is needed success = True if not community.instance.gone_forever: + follow_id = f"https://{current_app.config['SERVER_NAME']}/activities/follow/{gibberish(15)}" + if community.instance.domain == 'a.gup.pe': + join_request = CommunityJoinRequest.query.filter_by(user_id=current_user.id, community_id=community.id).first() + if join_request: + follow_id = f"https://{current_app.config['SERVER_NAME']}/activities/follow/{join_request.id}" undo_id = f"https://{current_app.config['SERVER_NAME']}/activities/undo/" + gibberish(15) follow = { "actor": current_user.public_url(), "to": [community.public_url()], "object": community.public_url(), "type": "Follow", - "id": f"https://{current_app.config['SERVER_NAME']}/activities/follow/{gibberish(15)}" + "id": follow_id } undo = { 'actor': current_user.public_url(),