Merge remote-tracking branch 'origin/main'

This commit is contained in:
rimu 2024-05-16 21:43:43 +12:00
commit 9e003a5d8b

View file

@ -1361,14 +1361,15 @@ def create_post_reply(activity_log: ActivityPubLog, community: Community, in_rep
post = Post.query.get(post_id) post = Post.query.get(post_id)
# special case: add comment from auto-tldr bot to post body if body is empty # special case: add comment from auto-tldr bot to post body if body is empty
if user.ap_id == 'autotldr@lemmings.world' and post.body.strip() == '': if user.ap_id == 'autotldr@lemmings.world':
if not '::: spoiler' in post_reply.body: if not post.body or (post.body and post.body.strip() == ''):
post.body = "🤖 I'm a bot that provides automatic summaries for articles:\n::: spoiler Click here to see the summary\n" + post_reply.body + '\n:::' if not '::: spoiler' in post_reply.body:
else: post.body = "🤖 I'm a bot that provides automatic summaries for articles:\n::: spoiler Click here to see the summary\n" + post_reply.body + '\n:::'
post.body = post_reply.body else:
post.body_html = lemmy_markdown_to_html(post.body) + '\n\n<small><span class="render_username">Generated using AI by: <a href="/u/autotldr@lemmings.world" title="AutoTL;DR">AutoTL;DR</a></span></small>' post.body = post_reply.body
db.session.commit() post.body_html = lemmy_markdown_to_html(post.body) + '\n\n<small><span class="render_username">Generated using AI by: <a href="/u/autotldr@lemmings.world" title="AutoTL;DR">AutoTL;DR</a></span></small>'
return None db.session.commit()
return None
if post.comments_enabled: if post.comments_enabled:
anchor = None anchor = None