From 5109b212917b783c560fcb2e2bc86b33c3269bc6 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 8 Aug 2021 01:02:05 +0200 Subject: [PATCH] fd --- files/classes/submission.py | 6 +++--- files/helpers/get.py | 8 ++++---- files/routes/comments.py | 2 +- files/routes/front.py | 2 +- files/routes/posts.py | 2 +- files/templates/comments.html | 2 +- files/templates/submission.html | 2 +- files/templates/submission_banned.html | 2 +- files/templates/submission_listing.html | 2 +- 9 files changed, 14 insertions(+), 14 deletions(-) diff --git a/files/classes/submission.py b/files/classes/submission.py index c7c5ed6af..8ac0b626a 100644 --- a/files/classes/submission.py +++ b/files/classes/submission.py @@ -238,7 +238,7 @@ class Submission(Base, Stndrd, Age_times, Scores, Fuzzing): #'award_count': self.award_count, 'meta_title': self.meta_title, 'meta_description': self.meta_description, - 'voted': self.voted, + 'voted': self._voted, 'flags': flags, } @@ -284,7 +284,7 @@ class Submission(Base, Stndrd, Age_times, Scores, Fuzzing): data["replies"]=[x.json_core for x in self.replies] if "voted" in self.__dict__: - data["voted"] = self.voted + data["voted"] = self._voted return data @@ -293,7 +293,7 @@ class Submission(Base, Stndrd, Age_times, Scores, Fuzzing): @property def voted(self): - return self.voted if "voted" in self.__dict__ else 0 + return self._voted if "voted" in self.__dict__ else 0 @property def title(self): diff --git a/files/helpers/get.py b/files/helpers/get.py index 6498fedca..fa6d4f31f 100644 --- a/files/helpers/get.py +++ b/files/helpers/get.py @@ -104,7 +104,7 @@ def get_post(i, v=None, graceful=False, **kwargs): if not items and not graceful: abort(404) x = items[0] - x.voted = items[1] or 0 + x._voted = items[1] or 0 x._is_blocking = items[2] or 0 else: items = g.db.query( @@ -154,7 +154,7 @@ def get_posts(pids, v=None): output = [p[0] for p in query] for i in range(len(output)): - output[i].voted = query[i][1] or 0 + output[i]._voted = query[i][1] or 0 output[i]._is_blocking = query[i][2] or 0 output[i]._is_blocked = query[i][3] or 0 else: @@ -190,7 +190,7 @@ def get_comment(i, v=None, graceful=False, **kwargs): vt = g.db.query(CommentVote).filter_by(user_id=v.id, comment_id=Comment.id).first() comment._is_blocking = block and block.user_id == v.id comment._is_blocked = block and block.target_id == v.id - comment.voted = vt.vote_type if vt else 0 + comment._voted = vt.vote_type if vt else 0 else: comment = g.db.query(Comment).filter(Comment.id == i).first() @@ -237,7 +237,7 @@ def get_comments(cids, v=None, load_parent=False): for c in comments: comment = c[0] if comment.author and comment.author.shadowbanned and not (v and v.id == comment.author_id): continue - comment.voted = c[1] or 0 + comment._voted = c[1] or 0 comment._is_blocking = c[2] or 0 comment._is_blocked = c[3] or 0 output.append(comment) diff --git a/files/routes/comments.py b/files/routes/comments.py index 583401651..e84ee63ad 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -133,7 +133,7 @@ def post_pid_comment_cid(cid, pid=None, anything=None, v=None): for c in comments: comment = c[0] if comment.author and comment.author.shadowbanned and not (v and v.id == comment.author_id): continue - comment.voted = c[1] or 0 + comment._voted = c[1] or 0 comment._is_blocking = c[2] or 0 comment._is_blocked = c[3] or 0 output.append(comment) diff --git a/files/routes/front.py b/files/routes/front.py index 8be11349b..e5b21f8d2 100644 --- a/files/routes/front.py +++ b/files/routes/front.py @@ -144,7 +144,7 @@ def frontlist(v=None, sort="hot", page=1,t="all", ids_only=True, filter_words='' secondrange = firstrange+1000 posts = posts[firstrange:secondrange] - if v and v.hidevotedon: posts = [x for x in posts if x.voted == 0] + if v and v.hidevotedon: posts = [x for x in posts if x._voted == 0] if page == 1: posts = g.db.query(Submission).filter_by(stickied=True).all() + posts diff --git a/files/routes/posts.py b/files/routes/posts.py index 59fa50dcc..cc04485bf 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -125,7 +125,7 @@ def post_id(pid, anything=None, v=None): for c in comments: comment = c[0] if comment.author and comment.author.shadowbanned and not (v and v.id == comment.author_id): continue - comment.voted = c[1] or 0 + comment._voted = c[1] or 0 comment._is_blocking = c[2] or 0 comment._is_blocked = c[3] or 0 output.append(comment) diff --git a/files/templates/comments.html b/files/templates/comments.html index 4aaeb695f..854b190a7 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -69,7 +69,7 @@ {% set score=c.score %} {% if v %} -{% set voted=c.voted %} +{% set voted=c._voted %} {% else %} {% set voted=-2 %} diff --git a/files/templates/submission.html b/files/templates/submission.html index a53406c59..9b04de22d 100644 --- a/files/templates/submission.html +++ b/files/templates/submission.html @@ -15,7 +15,7 @@ {% set score=ups-downs %} {% if v %} -{% set voted=p.voted if p.voted else 0 %} +{% set voted=p._voted if p._voted else 0 %} {% else %} {% set voted=-2 %} {% endif %} diff --git a/files/templates/submission_banned.html b/files/templates/submission_banned.html index 6eeb1b578..2f8dc0845 100644 --- a/files/templates/submission_banned.html +++ b/files/templates/submission_banned.html @@ -2,7 +2,7 @@ {% set score=p.score_fuzzed %} {% if v %} -{% set voted=p.voted %} +{% set voted=p._voted %} {% set adjust=voted %} {% else %} {% set voted=-2 %} diff --git a/files/templates/submission_listing.html b/files/templates/submission_listing.html index ed021aead..8c3b3eebd 100644 --- a/files/templates/submission_listing.html +++ b/files/templates/submission_listing.html @@ -14,7 +14,7 @@ {% set score=ups-downs %} {% if v %} - {% set voted= p.voted %} + {% set voted= p._voted %} {% else %} {% set voted=-2 %} {% endif %}