forked from forks/microblog.pub
Add DM/mention button on profile
This commit is contained in:
parent
81c2ef8961
commit
ccd77adcb6
3 changed files with 26 additions and 2 deletions
|
@ -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()],
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
<p>
|
||||
<select name="visibility">
|
||||
{% for (k, v) in visibility_choices %}
|
||||
<option value="{{ k }}" {% if in_reply_to_object and in_reply_to_object.visibility.name == k %}selected{% endif %}>{{ v }}</option>
|
||||
<option value="{{ k }}" {% if visibility == k or in_reply_to_object and in_reply_to_object.visibility.name == k %}selected{% endif %}>{{ v }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</p>
|
||||
|
|
|
@ -174,6 +174,23 @@
|
|||
</form>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro admin_dm_button(actor_handle) %}
|
||||
<form action="/admin/new" method="GET">
|
||||
<input type="hidden" name="with_content" value="{{ actor_handle }}">
|
||||
<input type="hidden" name="with_visibility" value="DIRECT">
|
||||
<button type="submit">direct message</button>
|
||||
</form>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro admin_mention_button(actor_handle) %}
|
||||
<form action="/admin/new" method="GET">
|
||||
<input type="hidden" name="with_content" value="{{ actor_handle }}">
|
||||
<button type="submit">mention</button>
|
||||
</form>
|
||||
{% endmacro %}
|
||||
|
||||
|
||||
|
||||
{% macro admin_profile_button(ap_actor_id) %}
|
||||
<form action="{{ url_for("admin_profile") }}" method="GET">
|
||||
<input type="hidden" name="actor_id" value="{{ ap_actor_id }}">
|
||||
|
@ -248,7 +265,7 @@
|
|||
{% endif %}
|
||||
{% if metadata.is_follower %}
|
||||
<li>follows you</li>
|
||||
{% if not metadata.is_following %}
|
||||
{% if not metadata.is_following and not with_details %}
|
||||
<li>{{ admin_profile_button(actor.ap_id) }}</li>
|
||||
{% endif %}
|
||||
</li>
|
||||
|
@ -261,6 +278,8 @@
|
|||
<li>{{ admin_block_button(actor) }}</li>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
<li>{{ admin_dm_button(actor.handle) }}</li>
|
||||
<li>{{ admin_mention_button(actor.handle) }}</li>
|
||||
{% if pending_incoming_follow_notif %}
|
||||
{% if not pending_incoming_follow_notif.is_accepted and not pending_incoming_follow_notif.is_rejected %}
|
||||
<li>
|
||||
|
|
Loading…
Reference in a new issue