forked from forks/microblog.pub
Copy over the content warning when replying
This commit is contained in:
parent
3fc6ac19f4
commit
9f3956db67
3 changed files with 8 additions and 1 deletions
|
@ -136,6 +136,7 @@ async def admin_new(
|
||||||
db_session: AsyncSession = Depends(get_db_session),
|
db_session: AsyncSession = Depends(get_db_session),
|
||||||
) -> templates.TemplateResponse:
|
) -> templates.TemplateResponse:
|
||||||
content = ""
|
content = ""
|
||||||
|
content_warning = None
|
||||||
in_reply_to_object = None
|
in_reply_to_object = None
|
||||||
if in_reply_to:
|
if in_reply_to:
|
||||||
in_reply_to_object = await boxes.get_anybox_object_by_ap_id(
|
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"])
|
mentioned_actor = await fetch_actor(db_session, tag["href"])
|
||||||
content += f"{mentioned_actor.handle} "
|
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(
|
return await templates.render_template(
|
||||||
db_session,
|
db_session,
|
||||||
request,
|
request,
|
||||||
|
@ -159,6 +164,7 @@ async def admin_new(
|
||||||
{
|
{
|
||||||
"in_reply_to_object": in_reply_to_object,
|
"in_reply_to_object": in_reply_to_object,
|
||||||
"content": content,
|
"content": content,
|
||||||
|
"content_warning": content_warning,
|
||||||
"visibility_choices": [
|
"visibility_choices": [
|
||||||
(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
|
||||||
|
|
|
@ -76,6 +76,7 @@ _RESIZED_CACHE: MutableMapping[tuple[str, int], tuple[bytes, str, Any]] = LFUCac
|
||||||
# TODO(ts):
|
# TODO(ts):
|
||||||
#
|
#
|
||||||
# Next:
|
# Next:
|
||||||
|
# - allow to manually approve follow requests
|
||||||
# - prevent double accept/double follow
|
# - prevent double accept/double follow
|
||||||
# - UI support for updating posts
|
# - UI support for updating posts
|
||||||
# - indieauth tweaks
|
# - indieauth tweaks
|
||||||
|
|
|
@ -75,7 +75,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<input type="text" name="content_warning" placeholder="content warning (will mark the post as sensitive)" style="width:95%;">
|
<input type="text" name="content_warning" placeholder="content warning (will mark the post as sensitive)"{% if content_warning %} value="{{ content_warning }}"{% endif %} style="width:95%;">
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<input type="checkbox" name="is_sensitive" id="is_sensitive"> <label for="is_sensitive">Mark attachment(s) as sensitive</label>
|
<input type="checkbox" name="is_sensitive" id="is_sensitive"> <label for="is_sensitive">Mark attachment(s) as sensitive</label>
|
||||||
|
|
Loading…
Reference in a new issue