add: nsfw marker for posts/communities

This commit is contained in:
trisua 2025-04-07 16:32:09 -04:00
parent f83cfa3756
commit 51534fbd52
8 changed files with 49 additions and 7 deletions

View file

@ -1,4 +1,4 @@
{% extends "root.html" %} {% block body %}
{% import "macros.html" as macros %} {% extends "root.html" %} {% block body %}
<main class="flex flex-col gap-2" style="max-width: 25rem">
<h2 class="w-full text-center">{% block title %}{% endblock %}</h2>
<div class="card w-full flex flex-col gap-4 justify-center align-center">

View file

@ -16,13 +16,26 @@
community=community, size="72px") }}
<div class="flex flex-col">
<div class="flex gap-2 items-center">
<h3 id="title" class="title name shorter">
<h3
id="title"
class="title name shorter flex gap-2"
>
<!-- prettier-ignore -->
{% if community.context.display_name %}
{{ community.context.display_name }}
{% else %}
{{ community.title }}
{% endif %}
{% if community.context.is_nsfw %}
<span
title="NSFW community"
class="flex items-center"
style="color: var(--color-primary)"
>
{{ icon "square-asterisk" }}
</span>
{% endif %}
</h3>
{% if user %} {% if user.id != community.owner

View file

@ -116,6 +116,11 @@
"{{ post.context.comments_enabled }}",
"checkbox",
],
[
["is_nsfw", "Mark as NSFW"],
"{{ community.context.is_nsfw }}",
"checkbox",
],
];
if (can_manage_pins) {

View file

@ -548,6 +548,11 @@
"{{ community.context.description }}",
"textarea",
],
[
["is_nsfw", "Mark as NSFW"],
"{{ community.context.is_nsfw }}",
"checkbox",
],
],
settings,
);

View file

@ -157,6 +157,14 @@ show_community and post.community != config.town_square %}
{{ components::community_avatar(id=post.community) }}
{% endif %}
</a>
{% endif %} {% if post.context.is_nsfw %}
<span
title="NSFW post"
class="flex items-center"
style="color: var(--color-primary)"
>
{{ icon "square-asterisk" }}
</span>
{% endif %}
</div>
@ -389,7 +397,7 @@ config.town_square and user %}
<form
class="card flex flex-col gap-2"
onsubmit="create_post_from_form(event)"
onsubmit="create_post_from_form_town_square(event)"
>
<div class="flex flex-col gap-1">
<label for="content">{{ text "communities:label.content" }}</label>
@ -409,7 +417,7 @@ config.town_square and user %}
</div>
<script>
async function create_post_from_form(e) {
async function create_post_from_form_town_square(e) {
e.preventDefault();
await trigger("atto::debounce", ["posts::create"]);
fetch("/api/v1/posts", {