mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 19:36:56 -08:00
Prefer image in attachment for image posts #350
This commit is contained in:
parent
594b858bd4
commit
5e422131ad
2 changed files with 4 additions and 10 deletions
|
@ -917,12 +917,9 @@ def post_json_to_model(activity_log, post_json, user, community) -> Post:
|
|||
if post.url:
|
||||
if is_image_url(post.url):
|
||||
post.type = POST_TYPE_IMAGE
|
||||
if 'image' in post_json and 'url' in post_json['image']:
|
||||
image = File(source_url=post_json['image']['url'])
|
||||
else:
|
||||
image = File(source_url=post.url)
|
||||
if alt_text:
|
||||
image.alt_text = alt_text
|
||||
image = File(source_url=post.url)
|
||||
if alt_text:
|
||||
image.alt_text = alt_text
|
||||
db.session.add(image)
|
||||
post.image = image
|
||||
elif is_video_url(post.url):
|
||||
|
|
|
@ -1233,10 +1233,7 @@ class Post(db.Model):
|
|||
if post.url:
|
||||
if is_image_url(post.url):
|
||||
post.type = constants.POST_TYPE_IMAGE
|
||||
if 'image' in request_json['object'] and 'url' in request_json['object']['image']:
|
||||
image = File(source_url=request_json['object']['image']['url'])
|
||||
else:
|
||||
image = File(source_url=post.url)
|
||||
image = File(source_url=post.url)
|
||||
if alt_text:
|
||||
image.alt_text = alt_text
|
||||
db.session.add(image)
|
||||
|
|
Loading…
Add table
Reference in a new issue