From 814bf0a5f3349408ac0d6bfdfda7ab763d03035c Mon Sep 17 00:00:00 2001 From: Aevann Date: Tue, 16 May 2023 03:07:35 +0300 Subject: [PATCH] same as last comit --- files/classes/flags.py | 12 ++++++++++++ files/templates/comments.html | 2 +- files/templates/submission.html | 2 +- files/templates/submission_listing.html | 2 +- files/templates/util/macros.html | 4 ++-- 5 files changed, 17 insertions(+), 5 deletions(-) diff --git a/files/classes/flags.py b/files/classes/flags.py index c4406ce52..ac110e510 100644 --- a/files/classes/flags.py +++ b/files/classes/flags.py @@ -29,6 +29,12 @@ class Flag(Base): def realreason(self, v): return censor_slurs(self.reason, v) + #lazy hack to avoid having to rename the comment_id column and causing potential new bugs + @property + @lazy + def parent_id(self): + return self.post_id + class CommentFlag(Base): __tablename__ = "commentflags" @@ -50,3 +56,9 @@ class CommentFlag(Base): @lazy def realreason(self, v): return censor_slurs(self.reason, v) + + #lazy hack to avoid having to rename the comment_id column and causing potential new bugs + @property + @lazy + def parent_id(self): + return self.comment_id diff --git a/files/templates/comments.html b/files/templates/comments.html index 142fdcca5..bbf32caec 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -235,7 +235,7 @@ {% endif %} - {{macros.flags(c)}} + {{macros.flags(c, 'comment')}} {% if c.is_banned and c.ban_reason %}
removed by @{{c.ban_reason}} (Admin)
diff --git a/files/templates/submission.html b/files/templates/submission.html index bf4b60090..9912596e0 100644 --- a/files/templates/submission.html +++ b/files/templates/submission.html @@ -77,7 +77,7 @@ {{macros.post_meta(p)}} - {{macros.flags(p)}} + {{macros.flags(p, 'post')}} {% if p.realurl(v) and not v_forbid_deleted %}

diff --git a/files/templates/submission_listing.html b/files/templates/submission_listing.html index aba83d27c..82df2041d 100644 --- a/files/templates/submission_listing.html +++ b/files/templates/submission_listing.html @@ -26,7 +26,7 @@ {% set v_forbid_deleted = (p.deleted_utc != 0 or p.is_banned) and not (v and v.admin_level >= PERMS['POST_COMMENT_MODERATION']) and not (v and v.id == p.author_id) %} -{{macros.flags(p)}} +{{macros.flags(p, 'post')}}
diff --git a/files/templates/util/macros.html b/files/templates/util/macros.html index 5112a1f11..93de4dcaa 100644 --- a/files/templates/util/macros.html +++ b/files/templates/util/macros.html @@ -197,7 +197,7 @@ {% endif %} {% endmacro %} -{% macro flags(i) %} +{% macro flags(i, kind) %} {% if i.active_flags(v) %}
Reported by: @@ -210,7 +210,7 @@ {{f.user.username}} {% if f.reason %}: {{f.realreason(v) | safe}}{% endif %} {% if v and v.admin_level >= PERMS['FLAGS_REMOVE'] %} - + {% endif %} {% endfor %}