remotes/1693045480750635534/spooky-22
Aevann1 2021-08-08 01:03:15 +02:00
parent 5109b21291
commit acdf0da347
9 changed files with 14 additions and 14 deletions

View File

@ -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):

View File

@ -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)

View File

@ -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)

View File

@ -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

View File

@ -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)

View File

@ -69,7 +69,7 @@
{% set score=c.score %}
{% if v %}
{% set voted=c._voted %}
{% set voted=c.voted %}
{% else %}
{% set voted=-2 %}

View File

@ -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 %}

View File

@ -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 %}

View File

@ -14,7 +14,7 @@
{% set score=ups-downs %}
{% if v %}
{% set voted= p._voted %}
{% set voted= p.voted %}
{% else %}
{% set voted=-2 %}
{% endif %}