Also use public_url() for User Follower activity

This commit is contained in:
freamon 2024-09-01 17:49:46 +01:00
parent 62f90ae772
commit 1af76320b7
3 changed files with 13 additions and 13 deletions

View file

@ -1461,18 +1461,18 @@ def process_user_follow_request(request_json, activitypublog_id, remote_user_id)
auto_accept = not local_user.ap_manually_approves_followers auto_accept = not local_user.ap_manually_approves_followers
new_follower = UserFollower(local_user_id=local_user.id, remote_user_id=remote_user.id, is_accepted=auto_accept) new_follower = UserFollower(local_user_id=local_user.id, remote_user_id=remote_user.id, is_accepted=auto_accept)
if not local_user.ap_followers_url: if not local_user.ap_followers_url:
local_user.ap_followers_url = local_user.ap_public_url + '/followers' local_user.ap_followers_url = local_user.public_url() + '/followers'
db.session.add(new_follower) db.session.add(new_follower)
accept = { accept = {
"@context": default_context(), "@context": default_context(),
"actor": local_user.ap_profile_id, "actor": local_user.public_url(),
"to": [ "to": [
remote_user.ap_profile_id remote_user.public_url()
], ],
"object": { "object": {
"actor": remote_user.ap_profile_id, "actor": remote_user.public_url(),
"to": None, "to": None,
"object": local_user.ap_profile_id, "object": local_user.public_url(),
"type": "Follow", "type": "Follow",
"id": follow_id "id": follow_id
}, },

View file

@ -760,12 +760,12 @@ def federate_post_to_user_followers(post):
'type': 'Note', 'type': 'Note',
'id': post.ap_id, 'id': post.ap_id,
'inReplyTo': None, 'inReplyTo': None,
'attributedTo': current_user.ap_profile_id, 'attributedTo': current_user.public_url(),
'to': [ 'to': [
'https://www.w3.org/ns/activitystreams#Public' 'https://www.w3.org/ns/activitystreams#Public'
], ],
'cc': [ 'cc': [
current_user.ap_followers_url current_user.followers_url()
], ],
'content': '', 'content': '',
'mediaType': 'text/html', 'mediaType': 'text/html',
@ -783,12 +783,12 @@ def federate_post_to_user_followers(post):
} }
create = { create = {
"id": f"https://{current_app.config['SERVER_NAME']}/activities/create/{gibberish(15)}", "id": f"https://{current_app.config['SERVER_NAME']}/activities/create/{gibberish(15)}",
"actor": current_user.ap_profile_id, "actor": current_user.public_url(),
"to": [ "to": [
"https://www.w3.org/ns/activitystreams#Public" "https://www.w3.org/ns/activitystreams#Public"
], ],
"cc": [ "cc": [
current_user.ap_followers_url current_user.followers_url()
], ],
"type": "Create", "type": "Create",
"object": note, "object": note,

View file

@ -1109,12 +1109,12 @@ def federate_post_edit_to_user_followers(post):
'type': 'Note', 'type': 'Note',
'id': post.ap_id, 'id': post.ap_id,
'inReplyTo': None, 'inReplyTo': None,
'attributedTo': current_user.ap_profile_id, 'attributedTo': current_user.public_url(),
'to': [ 'to': [
'https://www.w3.org/ns/activitystreams#Public' 'https://www.w3.org/ns/activitystreams#Public'
], ],
'cc': [ 'cc': [
current_user.ap_followers_url current_user.followers_url()
], ],
'content': '', 'content': '',
'mediaType': 'text/html', 'mediaType': 'text/html',
@ -1133,12 +1133,12 @@ def federate_post_edit_to_user_followers(post):
} }
update = { update = {
"id": f"https://{current_app.config['SERVER_NAME']}/activities/create/{gibberish(15)}", "id": f"https://{current_app.config['SERVER_NAME']}/activities/create/{gibberish(15)}",
"actor": current_user.ap_profile_id, "actor": current_user.public_url(),
"to": [ "to": [
"https://www.w3.org/ns/activitystreams#Public" "https://www.w3.org/ns/activitystreams#Public"
], ],
"cc": [ "cc": [
current_user.ap_followers_url current_user.followers_url()
], ],
"type": "Update", "type": "Update",
"object": note, "object": note,