From ccd77adcb605c75e5c86e4760089f05cbf440bd4 Mon Sep 17 00:00:00 2001 From: Thomas Sileo Date: Thu, 11 Aug 2022 20:48:20 +0200 Subject: [PATCH] Add DM/mention button on profile --- app/admin.py | 5 +++++ app/templates/admin_new.html | 2 +- app/templates/utils.html | 21 ++++++++++++++++++++- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/app/admin.py b/app/admin.py index ad51f7a..11ca702 100644 --- a/app/admin.py +++ b/app/admin.py @@ -133,6 +133,8 @@ async def admin_new( request: Request, query: str | None = None, in_reply_to: str | None = None, + with_content: str | None = None, + with_visibility: str | None = None, db_session: AsyncSession = Depends(get_db_session), ) -> templates.TemplateResponse: content = "" @@ -156,6 +158,8 @@ async def admin_new( # Copy the content warning if any if in_reply_to_object.summary: content_warning = in_reply_to_object.summary + elif with_content: + content += f"{with_content} " return await templates.render_template( db_session, @@ -169,6 +173,7 @@ async def admin_new( (v.name, ap.VisibilityEnum.get_display_name(v)) for v in ap.VisibilityEnum ], + "visibility": with_visibility, "emojis": EMOJIS.split(" "), "custom_emojis": sorted( [dat for name, dat in EMOJIS_BY_NAME.items()], diff --git a/app/templates/admin_new.html b/app/templates/admin_new.html index 435a41b..8b43b6a 100644 --- a/app/templates/admin_new.html +++ b/app/templates/admin_new.html @@ -31,7 +31,7 @@

diff --git a/app/templates/utils.html b/app/templates/utils.html index f977b8b..7860f50 100644 --- a/app/templates/utils.html +++ b/app/templates/utils.html @@ -174,6 +174,23 @@ {% endmacro %} +{% macro admin_dm_button(actor_handle) %} +
+ + + +
+{% endmacro %} + +{% macro admin_mention_button(actor_handle) %} +
+ + +
+{% endmacro %} + + + {% macro admin_profile_button(ap_actor_id) %}
@@ -248,7 +265,7 @@ {% endif %} {% if metadata.is_follower %}
  • follows you
  • - {% if not metadata.is_following %} + {% if not metadata.is_following and not with_details %}
  • {{ admin_profile_button(actor.ap_id) }}
  • {% endif %} @@ -261,6 +278,8 @@
  • {{ admin_block_button(actor) }}
  • {% endif %} {% endif %} +
  • {{ admin_dm_button(actor.handle) }}
  • +
  • {{ admin_mention_button(actor.handle) }}
  • {% if pending_incoming_follow_notif %} {% if not pending_incoming_follow_notif.is_accepted and not pending_incoming_follow_notif.is_rejected %}