diff --git a/files/classes/submission.py b/files/classes/submission.py index 8ac0b626a..c7c5ed6af 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 fa6d4f31f..6498fedca 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 e84ee63ad..583401651 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 e5b21f8d2..8be11349b 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 cc04485bf..59fa50dcc 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 854b190a7..4aaeb695f 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 9b04de22d..a53406c59 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 2f8dc0845..6eeb1b578 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 8c3b3eebd..ed021aead 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 %}