ensure posts are tagged as nsfw inside nsfw communities

This commit is contained in:
rimu 2025-01-11 13:24:53 +13:00
parent e6d81db15f
commit 355d0cd860

View file

@ -1201,7 +1201,10 @@ class Post(db.Model):
microblog=microblog, microblog=microblog,
posted_at=utcnow() posted_at=utcnow()
) )
if community.nsfw:
post.nsfw = True # old Lemmy instances ( < 0.19.8 ) allow nsfw content in nsfw communities to be flagged as sfw which makes no sense
if community.nsfl:
post.nsfl = True
if 'content' in request_json['object'] and request_json['object']['content'] is not None: if 'content' in request_json['object'] and request_json['object']['content'] is not None:
if 'mediaType' in request_json['object'] and request_json['object']['mediaType'] == 'text/html': if 'mediaType' in request_json['object'] and request_json['object']['mediaType'] == 'text/html':
post.body_html = allowlist_html(request_json['object']['content']) post.body_html = allowlist_html(request_json['object']['content'])