From 9f3956db67e5394d24cb8774bdf17b6713d17153 Mon Sep 17 00:00:00 2001 From: Thomas Sileo Date: Mon, 1 Aug 2022 20:37:08 +0200 Subject: [PATCH] Copy over the content warning when replying --- app/admin.py | 6 ++++++ app/main.py | 1 + app/templates/admin_new.html | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/admin.py b/app/admin.py index a1e78d1..112e3cb 100644 --- a/app/admin.py +++ b/app/admin.py @@ -136,6 +136,7 @@ async def admin_new( db_session: AsyncSession = Depends(get_db_session), ) -> templates.TemplateResponse: content = "" + content_warning = None in_reply_to_object = None if in_reply_to: in_reply_to_object = await boxes.get_anybox_object_by_ap_id( @@ -152,6 +153,10 @@ async def admin_new( mentioned_actor = await fetch_actor(db_session, tag["href"]) content += f"{mentioned_actor.handle} " + # Copy the content warning if any + if in_reply_to_object.summary: + content_warning = in_reply_to_object.summary + return await templates.render_template( db_session, request, @@ -159,6 +164,7 @@ async def admin_new( { "in_reply_to_object": in_reply_to_object, "content": content, + "content_warning": content_warning, "visibility_choices": [ (v.name, ap.VisibilityEnum.get_display_name(v)) for v in ap.VisibilityEnum diff --git a/app/main.py b/app/main.py index 728eba3..678c299 100644 --- a/app/main.py +++ b/app/main.py @@ -76,6 +76,7 @@ _RESIZED_CACHE: MutableMapping[tuple[str, int], tuple[bytes, str, Any]] = LFUCac # TODO(ts): # # Next: +# - allow to manually approve follow requests # - prevent double accept/double follow # - UI support for updating posts # - indieauth tweaks diff --git a/app/templates/admin_new.html b/app/templates/admin_new.html index 37e16af..435a41b 100644 --- a/app/templates/admin_new.html +++ b/app/templates/admin_new.html @@ -75,7 +75,7 @@ {% endif %}

- +