only process post image if post url not banned

This commit is contained in:
rimu 2024-03-17 02:21:16 +13:00
parent dc87bafaaa
commit 5fb05f3e2f

View file

@ -1284,11 +1284,11 @@ def create_post(activity_log: ActivityPubLog, community: Community, request_json
if not domain.banned: if not domain.banned:
domain.post_count += 1 domain.post_count += 1
post.domain = domain post.domain = domain
if post is not None:
if 'image' in request_json['object'] and post.image is None: if 'image' in request_json['object'] and post.image is None:
image = File(source_url=request_json['object']['image']['url']) image = File(source_url=request_json['object']['image']['url'])
db.session.add(image) db.session.add(image)
post.image = image post.image = image
if post is not None:
db.session.add(post) db.session.add(post)
post.ranking = post_ranking(post.score, post.posted_at) post.ranking = post_ranking(post.score, post.posted_at)
community.post_count += 1 community.post_count += 1