- Changed HTML to support the new fancy ban system
- Added "banned" and "active_ban" bits in models.py
- IP bans are supported now.
This commit is contained in:
some weird guy
2023-08-24 12:20:32 -07:00
parent ca09f3295b
commit e49d856f71
10 changed files with 60 additions and 194 deletions
@@ -1,5 +1,5 @@
{% if not post.is_rm %}
{% load closedverse_tags %}<div id="post-{{ post.id }}" {% if post.spoils and not post.is_mine or not post.creator.is_active %}data-href-hidden{% else %}data-href{% endif %}="{% if post.is_reply %}{% url "main:comment-view" post.id %}{% else %}{% url "main:post-view" post.id %}{% endif %}" class="post post-subtype-default trigger{% if post.spoils and not post.is_mine or not post.creator.is_active or post.user_is_blocked %} hidden test-hidden{% endif %}{% if type == 2 %} post-list-outline{% endif %}" tabindex="0">
{% load closedverse_tags %}<div id="post-{{ post.id }}" {% if post.spoils and not post.is_mine or post.creator.banned %}data-href-hidden{% else %}data-href{% endif %}="{% if post.is_reply %}{% url "main:comment-view" post.id %}{% else %}{% url "main:post-view" post.id %}{% endif %}" class="post post-subtype-default trigger{% if post.spoils and not post.is_mine or post.creator.banned or post.user_is_blocked %} hidden test-hidden{% endif %}{% if type == 2 %} post-list-outline{% endif %}" tabindex="0">
{% if with_community_container %}
<p class="community-container">
{% if post.is_reply %}
@@ -15,9 +15,6 @@
<span class="owner-label">Community Owner</span>
{% endif %}
<p class="user-name"><a href="{% url "main:user-view" post.creator.username %}"{% if post.creator.color %}style=color:{{ post.creator.color }}{% endif %}>{{ post.creator.nickname }}</a></p>
{% if not post.creator.is_active %}
<p style="color: #f00;">Banned</p>
{% endif %}
<p class="timestamp-container">
<span class="spoiler-status{% if post.spoils %} spoiler{% endif %}">Spoilers·</span>
{% if post.has_edit %}
@@ -45,15 +42,15 @@
{% endif %}
{% if post.screenshot %}<a class="screenshot-container still-image" href="{% if post.is_reply %}{% url "main:comment-view" post.id %}{% else %}{% url "main:post-view" post.id %}{% endif %}"><img src="{{ post.screenshot }}"></a>{% endif %}
{% if post.video %}<div class="screenshot-container still-image"><video class="vidya" controls src="{{ post.video }}" style="max-width:100%;max-height: 450px;"></video></div>{% endif %}
{% if post.spoils and not post.is_mine and post.creator.is_active %}
{% if post.spoils and not post.is_mine and not post.creator.banned %}
<div class="hidden-content"><p>This post contains spoilers.</p>
<button type="button" class="hidden-content-button">View Post</button>
</div>
{% endif %}
{% if not post.creator.is_active %}
<div class="hidden-content"><p>Content hidden because its creator was banned. </p>
{% if post.creator.get_warned_reason %}
<p>Reason: {{post.creator.get_warned_reason}}
{% if post.creator.banned %}
<div class="hidden-content"><p>Content hidden because {{ post.creator.username }} was banned. </p>
{% if post.creator.active_ban %}
<p>Reason: {{post.creator.active_ban.reason }}
{% endif %}
<button type="button" class="hidden-content-button">View Anyway</button>
</p></div>
@@ -74,7 +71,7 @@
<div class="reply symbol"><span class="symbol-label">Comments</span><span class="reply-count">{{ post.number_comments }}</span></div>
{% endif %}
</div>
{% if post.recent_comment and post.recent_comment.creator.is_active %}
{% if post.recent_comment and not post.recent_comment.creator.banned %}
<div class="recent-reply-content">
{% if post.number_comments > 1 %}
<div class="recent-reply-read-more-container" tabindex="0">
@@ -1,11 +1,8 @@
{% if not comment.is_rm %}{% load closedverse_tags %}<li id="comment-{{ comment.id }}" {% if comment.spoils and not comment.is_mine or not comment.creator.is_active %}data-href-hidden{% else %}data-href{% endif %}="{% url "main:comment-view" comment.id %}" class="post {% if comment.owner_post %}my{% else %}other{% endif %}{% if comment.spoils and not comment.is_mine or not comment.creator.is_active %} hidden{% endif %} trigger">
{% if not comment.is_rm %}{% load closedverse_tags %}<li id="comment-{{ comment.id }}" {% if comment.spoils and not comment.is_mine or comment.creator.banned %}data-href-hidden{% else %}data-href{% endif %}="{% url "main:comment-view" comment.id %}" class="post {% if comment.owner_post %}my{% else %}other{% endif %}{% if comment.spoils and not comment.is_mine or comment.creator.banned %} hidden{% endif %} trigger">
{% user_icon_container comment.creator comment.feeling %}
<div class="body">
<div class="header">
<p class="user-name"><a {% if comment.creator.color %}style=color:{{ comment.creator.color }}{% endif %} href="{% url "main:user-view" comment.creator.username %}">{{ comment.creator.nickname }}</a></p>
{% if not comment.creator.is_active %}
<p style="color: #f00;">Banned</p>
{% endif %}
<p class="timestamp-container">
<a class="timestamp" {% if comment.spoils and not comment.is_mine %}data-href-hidden{% else %}href{% endif %}="{% url "main:comment-view" comment.id %}">{% time comment.created %}</a>
{% if comment.drawing %}
@@ -26,15 +23,15 @@
{% if comment.screenshot %}
<div class="screenshot-container still-image"><img src="{{ comment.screenshot }}"></div>
{% endif %}
{% if comment.spoils and not comment.is_mine and comment.creator.is_active %}
{% if comment.spoils and not comment.is_mine and not comment.creator.banned %}
<div class="hidden-content"><p>This comment contains spoilers.</p>
<button type="button" class="hidden-content-button">View Comment</button>
</div>
{% endif %}
{% if not comment.creator.is_active %}
<div class="hidden-content"><p>Content hidden because its creator was banned. </p>
{% if comment.creator.get_warned_reason %}
<p>Reason: {{comment.creator.get_warned_reason}}
{% if comment.creator.banned %}
<div class="hidden-content"><p>Content hidden because {{ comment.creator.username }} was banned. </p>
{% if comment.creator.active_ban %}
<p>Reason: {{comment.creator.active_ban.reason }}
{% endif %}
<button type="button" class="hidden-content-button">View Anyway</button>
</p></div>
@@ -1,4 +1,4 @@
{% load closedverse_tags %}<div {% if post.spoils and not post.is_mine or not post.creator.is_active %}data-href-hidden{% else %}data-href{% endif %}="{% url "main:post-view" post.id %}" class="post trigger{% if post.screenshot and not for_announcements %} with-image{% endif %}{% if post.spoils and not post.is_mine or not post.creator.is_active %} hidden test-hidden{% endif %}" tabindex="0">
{% load closedverse_tags %}<div {% if post.spoils and not post.is_mine or post.creator.banned %}data-href-hidden{% else %}data-href{% endif %}="{% url "main:post-view" post.id %}" class="post trigger{% if post.screenshot and not for_announcements %} with-image{% endif %}{% if post.spoils and not post.is_mine or post.creator.banned %} hidden test-hidden{% endif %}" tabindex="0">
<p class="community-container"><a {% if post.community.clickable %}href="{% url "main:community-view" post.community_id %}"{% endif %}><img src="{{ post.community.icon }}" class="community-icon">{{ post.community.name }}</a></p>
@@ -40,15 +40,15 @@
<p class="post-content-text">{{ post.body|truncatechars:100|linebreaksbr }}</p>
{% endif %}
{% endif %}
{% if post.spoils and not post.is_mine and post.creator.is_active %}
{% if post.spoils and not post.is_mine and not post.creator.banned %}
<div class="hidden-content"><p>This post contains spoilers.
<button type="button" class="hidden-content-button">View Post</button>
</p></div>
{% endif %}
{% if not post.creator.is_active %}
<div class="hidden-content"><p>Content hidden because its creator was banned. </p>
{% if post.creator.get_warned_reason %}
<p>Reason: {{post.creator.get_warned_reason}}
{% if post.creator.banned %}
<div class="hidden-content"><p>Content hidden because {{ post.creator.username }} was banned. </p>
{% if post.creator.active_ban %}
<p>Reason: {{post.creator.active_ban.reason }}
{% endif %}
<button type="button" class="hidden-content-button">View Anyway</button>
</p></div>
@@ -1,12 +1,12 @@
{% load closedverse_tags %}{% load closedverse_user %}
{% if user.is_authenticated %}<div id="sidebar" class="{% if general %}general{% else %}user{% endif %}-sidebar">
{% if not user.is_active %}
{% if user.banned %}
<div class="notice" style="background-color: #ff9797;border: 1px solid #ff5252;">
<b>Notice</b>: This user account is disabled.
<b>Notice</b>: This user is banned.
<div>
{% if user.get_warned_reason %}
<p>Reason: "{{ user.get_warned_reason }}"</p>
{% if user.active_ban.reason %}
<p>Reason: "{{ user.active_ban.reason }}"</p>
{% endif %}
</div>
</div>