mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 19:36:56 -08:00
Merge branch 'main' of https://codeberg.org/saint/pyfedi
This commit is contained in:
commit
3c50791594
1 changed files with 2 additions and 4 deletions
|
@ -166,7 +166,7 @@ def post_to_activity(post: Post, community: Community):
|
|||
if post.language is not None:
|
||||
activity_data["object"]["object"]["language"] = {"identifier": post.language}
|
||||
if post.type == POST_TYPE_LINK and post.url is not None:
|
||||
activity_data["object"]["object"]["attachment"] = {"href": post.url, "type": "Link"}
|
||||
activity_data["object"]["object"]["attachment"] = [{"href": post.url, "type": "Link"}]
|
||||
if post.image_id is not None:
|
||||
activity_data["object"]["object"]["image"] = {"url": post.image.view_url(), "type": "Image"}
|
||||
if post.image.alt_text:
|
||||
|
@ -598,9 +598,7 @@ def post_json_to_model(post_json, user, community) -> Post:
|
|||
elif 'content' in post_json:
|
||||
post.body_html = allowlist_html(post_json['content'])
|
||||
post.body = html_to_markdown(post.body_html)
|
||||
if 'attachment' in post_json and \
|
||||
len(post_json['attachment']) > 0 and \
|
||||
'type' in post_json['attachment'][0]:
|
||||
if 'attachment' in post_json and len(post_json['attachment']) > 0 and 'type' in post_json['attachment'][0]:
|
||||
if post_json['attachment'][0]['type'] == 'Link':
|
||||
post.url = post_json['attachment'][0]['href']
|
||||
if is_image_url(post.url):
|
||||
|
|
Loading…
Add table
Reference in a new issue