post_to_page: use post.community instead of also passing community

This commit is contained in:
freamon 2024-05-31 03:45:51 +01:00
parent f6f7af0a1e
commit c5596e2f08
2 changed files with 4 additions and 4 deletions

View file

@ -1244,7 +1244,7 @@ def community_featured(actor):
}
for post in posts:
community_data['orderedItems'].append(post_to_page(post, community))
community_data['orderedItems'].append(post_to_page(post))
return jsonify(community_data)

View file

@ -202,13 +202,13 @@ def post_to_activity(post: Post, community: Community):
return activity_data
def post_to_page(post: Post, community: Community):
def post_to_page(post: Post):
activity_data = {
"type": "Page",
"id": post.ap_id,
"attributedTo": post.author.ap_public_url,
"to": [
f"https://{current_app.config['SERVER_NAME']}/c/{community.name}",
f"https://{current_app.config['SERVER_NAME']}/c/{post.community.name}",
"https://www.w3.org/ns/activitystreams#Public"
],
"name": post.title,
@ -220,7 +220,7 @@ def post_to_page(post: Post, community: Community):
"sensitive": post.nsfw or post.nsfl,
"published": ap_datetime(post.created_at),
"stickied": post.sticky,
"audience": f"https://{current_app.config['SERVER_NAME']}/c/{community.name}",
"audience": f"https://{current_app.config['SERVER_NAME']}/c/{post.community.name}",
"tag": post.tags_for_activitypub(),
'language': {
'identifier': post.language_code(),