fix crash when creating image post

This commit is contained in:
rimu 2024-01-07 18:02:52 +13:00
parent 32a4d4c467
commit 908ae14799
4 changed files with 13 additions and 2 deletions

View file

@ -380,9 +380,9 @@ def add_post(actor):
'@context': default_context()
}
if post.type == POST_TYPE_LINK:
page.attachment = [{'href': post.url, 'type': 'Link'}]
page['attachment'] = [{'href': post.url, 'type': 'Link'}]
if post.image_id:
page.image = [{'type': 'Image', 'url': post.image.source_url}]
page['image'] = [{'type': 'Image', 'url': post.image.source_url}]
if not community.is_local(): # this is a remote community - send the post to the instance that hosts it
success = post_request(community.ap_inbox_url, create, current_user.private_key,
current_user.ap_profile_id + '#main-key')

View file

@ -782,4 +782,8 @@ fieldset legend {
}
}
.mobile_create_post {
float: right;
}
/*# sourceMappingURL=structure.css.map */

View file

@ -458,3 +458,7 @@ fieldset {
max-width: 1180px;
}
}
.mobile_create_post {
float: right;
}

View file

@ -1,3 +1,6 @@
<div class="mobile_create_post d-md-none mt-1">
<a class="btn btn-primary" href="/community/{{ community.link() }}/submit">{{ _('Create post') }}</a>
</div>
<div class="btn-group mt-1 mb-2">
<a href="?sort=hot" class="btn {{ 'btn-primary' if request.args.get('sort', '') == '' or request.args.get('sort', '') == 'hot' else 'btn-outline-secondary' }}" rel="nofollow">
{{ _('Hot') }}