fd
This commit is contained in:
parent
d309ac35ae
commit
baa1853f95
9 changed files with 14 additions and 14 deletions
|
@ -238,7 +238,7 @@ class Submission(Base, Stndrd, Age_times, Scores, Fuzzing):
|
||||||
#'award_count': self.award_count,
|
#'award_count': self.award_count,
|
||||||
'meta_title': self.meta_title,
|
'meta_title': self.meta_title,
|
||||||
'meta_description': self.meta_description,
|
'meta_description': self.meta_description,
|
||||||
'voted': self.voted,
|
'voted': self._voted,
|
||||||
'flags': flags,
|
'flags': flags,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -284,7 +284,7 @@ class Submission(Base, Stndrd, Age_times, Scores, Fuzzing):
|
||||||
data["replies"]=[x.json_core for x in self.replies]
|
data["replies"]=[x.json_core for x in self.replies]
|
||||||
|
|
||||||
if "voted" in self.__dict__:
|
if "voted" in self.__dict__:
|
||||||
data["voted"] = self.voted
|
data["voted"] = self._voted
|
||||||
|
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
@ -293,7 +293,7 @@ class Submission(Base, Stndrd, Age_times, Scores, Fuzzing):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def voted(self):
|
def voted(self):
|
||||||
return self.voted if "voted" in self.__dict__ else 0
|
return self._voted if "voted" in self.__dict__ else 0
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def title(self):
|
def title(self):
|
||||||
|
|
|
@ -104,7 +104,7 @@ def get_post(i, v=None, graceful=False, **kwargs):
|
||||||
if not items and not graceful:
|
if not items and not graceful:
|
||||||
abort(404)
|
abort(404)
|
||||||
x = items[0]
|
x = items[0]
|
||||||
x.voted = items[1] or 0
|
x._voted = items[1] or 0
|
||||||
x._is_blocking = items[2] or 0
|
x._is_blocking = items[2] or 0
|
||||||
else:
|
else:
|
||||||
items = g.db.query(
|
items = g.db.query(
|
||||||
|
@ -154,7 +154,7 @@ def get_posts(pids, v=None):
|
||||||
|
|
||||||
output = [p[0] for p in query]
|
output = [p[0] for p in query]
|
||||||
for i in range(len(output)):
|
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_blocking = query[i][2] or 0
|
||||||
output[i]._is_blocked = query[i][3] or 0
|
output[i]._is_blocked = query[i][3] or 0
|
||||||
else:
|
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()
|
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_blocking = block and block.user_id == v.id
|
||||||
comment._is_blocked = block and block.target_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:
|
else:
|
||||||
comment = g.db.query(Comment).filter(Comment.id == i).first()
|
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:
|
for c in comments:
|
||||||
comment = c[0]
|
comment = c[0]
|
||||||
if comment.author and comment.author.shadowbanned and not (v and v.id == comment.author_id): continue
|
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_blocking = c[2] or 0
|
||||||
comment._is_blocked = c[3] or 0
|
comment._is_blocked = c[3] or 0
|
||||||
output.append(comment)
|
output.append(comment)
|
||||||
|
|
|
@ -133,7 +133,7 @@ def post_pid_comment_cid(cid, pid=None, anything=None, v=None):
|
||||||
for c in comments:
|
for c in comments:
|
||||||
comment = c[0]
|
comment = c[0]
|
||||||
if comment.author and comment.author.shadowbanned and not (v and v.id == comment.author_id): continue
|
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_blocking = c[2] or 0
|
||||||
comment._is_blocked = c[3] or 0
|
comment._is_blocked = c[3] or 0
|
||||||
output.append(comment)
|
output.append(comment)
|
||||||
|
|
|
@ -144,7 +144,7 @@ def frontlist(v=None, sort="hot", page=1,t="all", ids_only=True, filter_words=''
|
||||||
secondrange = firstrange+1000
|
secondrange = firstrange+1000
|
||||||
posts = posts[firstrange:secondrange]
|
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
|
if page == 1: posts = g.db.query(Submission).filter_by(stickied=True).all() + posts
|
||||||
|
|
||||||
|
|
|
@ -125,7 +125,7 @@ def post_id(pid, anything=None, v=None):
|
||||||
for c in comments:
|
for c in comments:
|
||||||
comment = c[0]
|
comment = c[0]
|
||||||
if comment.author and comment.author.shadowbanned and not (v and v.id == comment.author_id): continue
|
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_blocking = c[2] or 0
|
||||||
comment._is_blocked = c[3] or 0
|
comment._is_blocked = c[3] or 0
|
||||||
output.append(comment)
|
output.append(comment)
|
||||||
|
|
|
@ -69,7 +69,7 @@
|
||||||
{% set score=c.score %}
|
{% set score=c.score %}
|
||||||
|
|
||||||
{% if v %}
|
{% if v %}
|
||||||
{% set voted=c.voted %}
|
{% set voted=c._voted %}
|
||||||
|
|
||||||
{% else %}
|
{% else %}
|
||||||
{% set voted=-2 %}
|
{% set voted=-2 %}
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
{% set score=ups-downs %}
|
{% set score=ups-downs %}
|
||||||
|
|
||||||
{% if v %}
|
{% if v %}
|
||||||
{% set voted=p.voted if p.voted else 0 %}
|
{% set voted=p._voted if p._voted else 0 %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% set voted=-2 %}
|
{% set voted=-2 %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
{% set score=p.score_fuzzed %}
|
{% set score=p.score_fuzzed %}
|
||||||
{% if v %}
|
{% if v %}
|
||||||
{% set voted=p.voted %}
|
{% set voted=p._voted %}
|
||||||
{% set adjust=voted %}
|
{% set adjust=voted %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% set voted=-2 %}
|
{% set voted=-2 %}
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
{% set score=ups-downs %}
|
{% set score=ups-downs %}
|
||||||
|
|
||||||
{% if v %}
|
{% if v %}
|
||||||
{% set voted= p.voted %}
|
{% set voted= p._voted %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% set voted=-2 %}
|
{% set voted=-2 %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue