diff --git a/files/classes/comment.py b/files/classes/comment.py
index 761384f98..32aed8efe 100644
--- a/files/classes/comment.py
+++ b/files/classes/comment.py
@@ -391,10 +391,14 @@ class Comment(Base):
@lazy
def is_op(self): return self.author_id==self.post.author_id
- @property
@lazy
- def active_flags(self): return len(self.flags)
-
+ def filtered_flags(self, v):
+ return [f for f in self.flags if (v and v.shadowbanned) or not f.user.shadowbanned]
+
+ @lazy
+ def active_flags(self, v):
+ return len(self.filtered_flags(v))
+
@lazy
def wordle_html(self, v):
if not self.wordle_result: return ''
diff --git a/files/classes/submission.py b/files/classes/submission.py
index 72477ca63..dfbd46606 100644
--- a/files/classes/submission.py
+++ b/files/classes/submission.py
@@ -401,7 +401,10 @@ class Submission(Base):
return True
return False
- @property
@lazy
- def active_flags(self):
- return len(self.flags)
\ No newline at end of file
+ def filtered_flags(self, v):
+ return [f for f in self.flags if (v and v.shadowbanned) or not f.user.shadowbanned]
+
+ @lazy
+ def active_flags(self, v):
+ return len(self.filtered_flags(v))
\ No newline at end of file
diff --git a/files/templates/comments.html b/files/templates/comments.html
index e7e81148a..1edf6466e 100644
--- a/files/templates/comments.html
+++ b/files/templates/comments.html
@@ -177,7 +177,7 @@
{% if c.bannedfor %}
{% endif %}
- {% if c.active_flags and (v and v.admin_level >= PERMS['FLAGS_VISIBLE']) %}{{c.active_flags}} Report{{ help.plural(c.active_flags) }}{% endif %}
+ {% if c.active_flags(v) and (v and v.admin_level >= PERMS['FLAGS_VISIBLE']) %}{{c.active_flags(v)}} Report{{ help.plural(c.active_flags(v)) }}{% endif %}
{% if c.over_18 %}{% endif %}
{% if v and v.admin_level > 1 and c.author.shadowbanned %}{% endif %}
{% if c.stickied %}
@@ -251,15 +251,13 @@
{{c.wordle_html(v) | safe}}
{% endif %}
- {% if c.active_flags and (v and v.admin_level >= PERMS['FLAGS_VISIBLE']) %}
+ {% if c.active_flags(v) and (v and v.admin_level >= PERMS['FLAGS_VISIBLE']) %}
Reported by:
- {% for f in c.flags %}
- {% if (v and v.shadowbanned) or not f.user.shadowbanned %}
- - {% if v and v.admin_level >= PERMS['FLAGS_VISIBLE_REPORTER'] %}{% if not c.ghost %}{{f.user.username}}{% else %}👻{% endif %}{% else %}User{% endif %}{% if f.reason %}: {{f.realreason(v) | safe}}{% endif %} {% if v and v.admin_level >= PERMS['FLAGS_REMOVE'] %}[remove]{% endif %}
- {% endif %}
+ {% for f in c.filtered_flags(v) %}
+ - {% if v and v.admin_level >= PERMS['FLAGS_VISIBLE_REPORTER'] %}{% if not c.ghost %}{{f.user.username}}{% else %}👻{% endif %}{% else %}User{% endif %}{% if f.reason %}: {{f.realreason(v) | safe}}{% endif %} {% if v and v.admin_level >= PERMS['FLAGS_REMOVE'] %}[remove]{% endif %}
{% endfor %}
diff --git a/files/templates/submission.html b/files/templates/submission.html
index 2cbc3d1e0..8189dbd20 100644
--- a/files/templates/submission.html
+++ b/files/templates/submission.html
@@ -658,7 +658,7 @@
{% if p.is_bot %} {% endif %}
{% if p.over_18 %}{% endif %}
{% if p.private %}{% endif %}
- {% if p.active_flags and (v and v.admin_level >= PERMS['FLAGS_VISIBLE']) %}{{p.active_flags}} Report{{ help.plural(p.active_flags) }}{% endif %}
+ {% if p.active_flags(v) and (v and v.admin_level >= PERMS['FLAGS_VISIBLE']) %}{{p.active_flags(v)}} Report{{ help.plural(p.active_flags(v)) }}{% endif %}
{% if p.ghost %}
👻
@@ -691,15 +691,13 @@
{% endif %}
{{p.views}} thread views
- {% if p.active_flags and (v and v.admin_level >= PERMS['FLAGS_VISIBLE']) %}
+ {% if p.active_flags(v) and (v and v.admin_level >= PERMS['FLAGS_VISIBLE']) %}
Reported by:
- {% for f in p.flags %}
- {% if (v and v.shadowbanned) or not f.user.shadowbanned %}
- - {% if v and v.admin_level >= PERMS['FLAGS_VISIBLE_REPORTER'] %}{{f.user.username}}{% else %}User{% endif %}{% if f.reason %}: {{f.realreason(v) | safe}}{% endif %} {% if v and v.admin_level >= PERMS['FLAGS_REMOVE'] %}[remove]{% endif %}
- {% endif %}
+ {% for f in p.filtered_flags(v) %}
+ - {% if v and v.admin_level >= PERMS['FLAGS_VISIBLE_REPORTER'] %}{{f.user.username}}{% else %}User{% endif %}{% if f.reason %}: {{f.realreason(v) | safe}}{% endif %} {% if v and v.admin_level >= PERMS['FLAGS_REMOVE'] %}[remove]{% endif %}
{% endfor %}
diff --git a/files/templates/submission_listing.html b/files/templates/submission_listing.html
index 6c14d6528..57bfff040 100644
--- a/files/templates/submission_listing.html
+++ b/files/templates/submission_listing.html
@@ -67,15 +67,13 @@
{% set v_forbid_deleted = (p.deleted_utc != 0 or p.is_banned) and not (v and v.admin_level >= 2) and not (v and v.id == p.author_id) %}
-{% if p.active_flags and (v and v.admin_level >= PERMS['FLAGS_VISIBLE']) %}
+{% if p.active_flags(v) and (v and v.admin_level >= PERMS['FLAGS_VISIBLE']) %}
Reported by:
- {% for f in p.flags %}
- {% if (v and v.shadowbanned) or not f.user.shadowbanned %}
- - {% if v and v.admin_level >= PERMS['FLAGS_VISIBLE_REPORTER'] %}{{f.user.username}}{% else %}User{% endif %}{% if f.reason %}: {{f.realreason(v) | safe}}{% endif %} {% if v and v.admin_level >= PERMS['FLAGS_REMOVE'] %}[remove]{% endif %}
- {% endif %}
+ {% for f in p.filtered_flags(v) %}
+ - {% if v and v.admin_level >= PERMS['FLAGS_VISIBLE_REPORTER'] %}{{f.user.username}}{% else %}User{% endif %}{% if f.reason %}: {{f.realreason(v) | safe}}{% endif %} {% if v and v.admin_level >= PERMS['FLAGS_REMOVE'] %}[remove]{% endif %}
{% endfor %}
@@ -191,7 +189,7 @@
{% if p.is_blocking %}{% endif %}
{% if p.is_blocked %}{% endif %}
{% if p.private %}{% endif %}
- {% if p.active_flags and (v and v.admin_level >= PERMS['FLAGS_VISIBLE']) %}{{p.active_flags}} Report{{ help.plural(p.active_flags) }}{% endif %}
+ {% if p.active_flags(v) and (v and v.admin_level >= PERMS['FLAGS_VISIBLE']) %}{{p.active_flags(v)}} Report{{ help.plural(p.active_flags(v)) }}{% endif %}
{% if p.ghost %}
👻