cxzxzc
This commit is contained in:
parent
13d2342b62
commit
b4dc4e1679
8 changed files with 49 additions and 33 deletions
|
@ -23,6 +23,7 @@ class Submission(Base):
|
|||
thumburl = Column(String)
|
||||
is_banned = Column(Boolean, default=False)
|
||||
bannedfor = Column(Boolean)
|
||||
ghost = Column(Boolean)
|
||||
views = Column(Integer, default=0)
|
||||
deleted_utc = Column(Integer, default=0)
|
||||
distinguish_level = Column(Integer, default=0)
|
||||
|
@ -53,6 +54,7 @@ class Submission(Base):
|
|||
approved_by = relationship("User", uselist=False, primaryjoin="Submission.is_approved==User.id", viewonly=True)
|
||||
awards = relationship("AwardRelationship", viewonly=True)
|
||||
reports = relationship("Flag", viewonly=True)
|
||||
comments = relationship("Comment", primaryjoin="Comment.parent_submission==Submission.id", viewonly=True)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
|
@ -62,7 +64,7 @@ class Submission(Base):
|
|||
|
||||
@property
|
||||
@lazy
|
||||
def comments(self):
|
||||
def comments2(self):
|
||||
return g.db.query(Comment.author_id, Comment.created_utc, Comment.id).filter(Comment.parent_submission == self.id, Comment.author_id.notin_((AUTOPOLLER_ID,AUTOBETTER_ID))).all()
|
||||
|
||||
@property
|
||||
|
@ -222,7 +224,7 @@ class Submission(Base):
|
|||
@property
|
||||
@lazy
|
||||
def author_name(self):
|
||||
if self.award_count('ghosts'): return '👻'
|
||||
if self.ghost: return '👻'
|
||||
else: return self.author.username
|
||||
|
||||
@property
|
||||
|
@ -321,7 +323,7 @@ class Submission(Base):
|
|||
if self.deleted_utc or self.is_banned:
|
||||
return data
|
||||
|
||||
data["author"]=self.author.json_core
|
||||
data["author"]='👻' if self.ghost else self.author.json_core
|
||||
data["comment_count"]=self.comment_count
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue