mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-02-02 16:21:32 -08:00
better image handling
This commit is contained in:
parent
4a1c4e2d08
commit
0f055f590d
2 changed files with 12 additions and 1 deletions
|
@ -1227,7 +1227,10 @@ def create_post(activity_log: ActivityPubLog, community: Community, request_json
|
|||
post.url = request_json['object']['attachment'][0]['href']
|
||||
if is_image_url(post.url):
|
||||
post.type = POST_TYPE_IMAGE
|
||||
image = File(source_url=request_json['object']['image']['url'])
|
||||
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)
|
||||
db.session.add(image)
|
||||
post.image = image
|
||||
else:
|
||||
|
|
|
@ -127,6 +127,14 @@ class ReportCommunityForm(FlaskForm):
|
|||
report_remote = BooleanField('Also send report to originating instance')
|
||||
submit = SubmitField(_l('Report'))
|
||||
|
||||
def reasons_to_string(self, reason_data) -> str:
|
||||
result = []
|
||||
for reason_id in reason_data:
|
||||
for choice in self.reason_choices:
|
||||
if choice[0] == reason_id:
|
||||
result.append(str(choice[1]))
|
||||
return ', '.join(result)
|
||||
|
||||
|
||||
class DeleteCommunityForm(FlaskForm):
|
||||
submit = SubmitField(_l('Delete community'))
|
||||
|
|
Loading…
Add table
Reference in a new issue