Added support for reading quoted posts properly

This commit is contained in:
2025-11-07 09:08:39 -06:00
parent 377578dbe2
commit a13e1f1f10
2 changed files with 12 additions and 0 deletions

View File

@@ -17,6 +17,11 @@ def compose_post(post, db, settings, relative_times, show_screen_names, safe=Tru
text = _("Boosted from @{}: {}").format(post.reblog.account.acct, templates.process_text(post.reblog, safe=safe)) text = _("Boosted from @{}: {}").format(post.reblog.account.acct, templates.process_text(post.reblog, safe=safe))
else: else:
text = templates.process_text(post, safe=safe) text = templates.process_text(post, safe=safe)
# Handle quoted posts
if hasattr(post, 'quote') and post.quote != None and hasattr(post.quote, 'quoted_status') and post.quote.quoted_status != None:
quoted_user = post.quote.quoted_status.account.acct
quoted_text = templates.process_text(post.quote.quoted_status, safe=safe)
text = text + " " + _("Quoting @{}: {}").format(quoted_user, quoted_text)
filtered = utils.evaluate_filters(post=post, current_context="home") filtered = utils.evaluate_filters(post=post, current_context="home")
if filtered != None: if filtered != None:
text = _("hidden by filter {}").format(filtered) text = _("hidden by filter {}").format(filtered)

View File

@@ -76,6 +76,13 @@ def render_post(post, template, settings, relative_times=False, offset_hours=0):
else: else:
text = process_text(post, safe=False) text = process_text(post, safe=False)
safe_text = process_text(post) safe_text = process_text(post)
# Handle quoted posts
if hasattr(post, 'quote') and post.quote != None and hasattr(post.quote, 'quoted_status') and post.quote.quoted_status != None:
quoted_user = post.quote.quoted_status.account.acct
quoted_text = process_text(post.quote.quoted_status, safe=False)
quoted_safe_text = process_text(post.quote.quoted_status, safe=True)
text = text + " " + _("Quoting @{}: {}").format(quoted_user, quoted_text)
safe_text = safe_text + " " + _("Quoting @{}: {}").format(quoted_user, quoted_safe_text)
filtered = utils.evaluate_filters(post=post, current_context="home") filtered = utils.evaluate_filters(post=post, current_context="home")
if filtered != None: if filtered != None:
text = _("hidden by filter {}").format(filtered) text = _("hidden by filter {}").format(filtered)