for 'warn' filtered posts, parse and display a modified text on them (we must add a way to display those later)

This commit is contained in:
2025-03-03 11:59:14 -06:00
parent c76134b064
commit 3dae674c4e
2 changed files with 12 additions and 0 deletions

View File

@@ -17,6 +17,9 @@ 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))
else:
text = templates.process_text(post, safe=safe)
filtered = utils.evaluate_filters(post=post, current_context="home")
if filtered != None:
text = _("hidden by filter {}").format(filtered)
source = post.get("application", "")
# "" means remote user, None for legacy apps so we should cover both sides.
if source != None and source != "":
@@ -73,4 +76,7 @@ def compose_notification(notification, db, settings, relative_times, show_screen
text = _("A poll in which you have voted has expired: {status}").format(status=",".join(compose_post(notification.status, db, settings, relative_times, show_screen_names, safe=safe)))
elif notification.type == "follow_request":
text = _("{username} wants to follow you.").format(username=user)
filtered = utils.evaluate_filters(post=notification, current_context="notifications")
if filtered != None:
text = _("hidden by filter {}").format(filtered)
return [user, text, ts]