Add DM/mention button on profile
parent
81c2ef8961
commit
ccd77adcb6
|
@ -133,6 +133,8 @@ async def admin_new(
|
||||||
request: Request,
|
request: Request,
|
||||||
query: str | None = None,
|
query: str | None = None,
|
||||||
in_reply_to: 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),
|
db_session: AsyncSession = Depends(get_db_session),
|
||||||
) -> templates.TemplateResponse:
|
) -> templates.TemplateResponse:
|
||||||
content = ""
|
content = ""
|
||||||
|
@ -156,6 +158,8 @@ async def admin_new(
|
||||||
# Copy the content warning if any
|
# Copy the content warning if any
|
||||||
if in_reply_to_object.summary:
|
if in_reply_to_object.summary:
|
||||||
content_warning = in_reply_to_object.summary
|
content_warning = in_reply_to_object.summary
|
||||||
|
elif with_content:
|
||||||
|
content += f"{with_content} "
|
||||||
|
|
||||||
return await templates.render_template(
|
return await templates.render_template(
|
||||||
db_session,
|
db_session,
|
||||||
|
@ -169,6 +173,7 @@ async def admin_new(
|
||||||
(v.name, ap.VisibilityEnum.get_display_name(v))
|
(v.name, ap.VisibilityEnum.get_display_name(v))
|
||||||
for v in ap.VisibilityEnum
|
for v in ap.VisibilityEnum
|
||||||
],
|
],
|
||||||
|
"visibility": with_visibility,
|
||||||
"emojis": EMOJIS.split(" "),
|
"emojis": EMOJIS.split(" "),
|
||||||
"custom_emojis": sorted(
|
"custom_emojis": sorted(
|
||||||
[dat for name, dat in EMOJIS_BY_NAME.items()],
|
[dat for name, dat in EMOJIS_BY_NAME.items()],
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
<p>
|
<p>
|
||||||
<select name="visibility">
|
<select name="visibility">
|
||||||
{% for (k, v) in visibility_choices %}
|
{% 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 %}
|
{% endfor %}
|
||||||
</select>
|
</select>
|
||||||
</p>
|
</p>
|
||||||
|
|
|
@ -174,6 +174,23 @@
|
||||||
</form>
|
</form>
|
||||||
{% endmacro %}
|
{% 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) %}
|
{% macro admin_profile_button(ap_actor_id) %}
|
||||||
<form action="{{ url_for("admin_profile") }}" method="GET">
|
<form action="{{ url_for("admin_profile") }}" method="GET">
|
||||||
<input type="hidden" name="actor_id" value="{{ ap_actor_id }}">
|
<input type="hidden" name="actor_id" value="{{ ap_actor_id }}">
|
||||||
|
@ -248,7 +265,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if metadata.is_follower %}
|
{% if metadata.is_follower %}
|
||||||
<li>follows you</li>
|
<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>
|
<li>{{ admin_profile_button(actor.ap_id) }}</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</li>
|
</li>
|
||||||
|
@ -261,6 +278,8 @@
|
||||||
<li>{{ admin_block_button(actor) }}</li>
|
<li>{{ admin_block_button(actor) }}</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
<li>{{ admin_dm_button(actor.handle) }}</li>
|
||||||
|
<li>{{ admin_mention_button(actor.handle) }}</li>
|
||||||
{% if pending_incoming_follow_notif %}
|
{% if pending_incoming_follow_notif %}
|
||||||
{% if not pending_incoming_follow_notif.is_accepted and not pending_incoming_follow_notif.is_rejected %}
|
{% if not pending_incoming_follow_notif.is_accepted and not pending_incoming_follow_notif.is_rejected %}
|
||||||
<li>
|
<li>
|
||||||
|
|
Loading…
Reference in New Issue