sdf
This commit is contained in:
parent
3b126e72f8
commit
06a36002a6
7 changed files with 31 additions and 25 deletions
|
@ -446,8 +446,9 @@ class Notification(Base):
|
||||||
|
|
||||||
__tablename__ = "notifications"
|
__tablename__ = "notifications"
|
||||||
|
|
||||||
user_id = Column(Integer, ForeignKey("users.id"), primary_key=True)
|
id = Column(Integer, primary_key=True)
|
||||||
comment_id = Column(Integer, ForeignKey("comments.id"), primary_key=True)
|
user_id = Column(Integer, ForeignKey("users.id"))
|
||||||
|
comment_id = Column(Integer, ForeignKey("comments.id"))
|
||||||
read = Column(Boolean, default=False)
|
read = Column(Boolean, default=False)
|
||||||
|
|
||||||
comment = relationship("Comment", viewonly=True)
|
comment = relationship("Comment", viewonly=True)
|
||||||
|
|
|
@ -9,8 +9,9 @@ class Flag(Base):
|
||||||
|
|
||||||
__tablename__ = "flags"
|
__tablename__ = "flags"
|
||||||
|
|
||||||
post_id = Column(Integer, ForeignKey("submissions.id"), primary_key=True)
|
id = Column(Integer, primary_key=True)
|
||||||
user_id = Column(Integer, ForeignKey("users.id"), primary_key=True)
|
post_id = Column(Integer, ForeignKey("submissions.id"))
|
||||||
|
user_id = Column(Integer, ForeignKey("users.id"))
|
||||||
reason = Column(String)
|
reason = Column(String)
|
||||||
|
|
||||||
user = relationship("User", primaryjoin = "Flag.user_id == User.id", uselist = False, viewonly=True)
|
user = relationship("User", primaryjoin = "Flag.user_id == User.id", uselist = False, viewonly=True)
|
||||||
|
@ -38,8 +39,9 @@ class CommentFlag(Base):
|
||||||
|
|
||||||
__tablename__ = "commentflags"
|
__tablename__ = "commentflags"
|
||||||
|
|
||||||
user_id = Column(Integer, ForeignKey("users.id"), primary_key=True)
|
id = Column(Integer, primary_key=True)
|
||||||
comment_id = Column(Integer, ForeignKey("comments.id"), primary_key=True)
|
user_id = Column(Integer, ForeignKey("users.id"))
|
||||||
|
comment_id = Column(Integer, ForeignKey("comments.id"))
|
||||||
reason = Column(String)
|
reason = Column(String)
|
||||||
|
|
||||||
user = relationship("User", primaryjoin = "CommentFlag.user_id == User.id", uselist = False, viewonly=True)
|
user = relationship("User", primaryjoin = "CommentFlag.user_id == User.id", uselist = False, viewonly=True)
|
||||||
|
|
|
@ -19,8 +19,9 @@ class Subscription(Base):
|
||||||
|
|
||||||
class Follow(Base):
|
class Follow(Base):
|
||||||
__tablename__ = "follows"
|
__tablename__ = "follows"
|
||||||
user_id = Column(Integer, ForeignKey("users.id"), primary_key=True)
|
id = Column(Integer, primary_key=True)
|
||||||
target_id = Column(Integer, ForeignKey("users.id"), primary_key=True)
|
user_id = Column(Integer, ForeignKey("users.id"))
|
||||||
|
target_id = Column(Integer, ForeignKey("users.id"))
|
||||||
|
|
||||||
user = relationship("User", uselist=False, primaryjoin="User.id==Follow.user_id", viewonly=True)
|
user = relationship("User", uselist=False, primaryjoin="User.id==Follow.user_id", viewonly=True)
|
||||||
target = relationship("User", primaryjoin="User.id==Follow.target_id", viewonly=True)
|
target = relationship("User", primaryjoin="User.id==Follow.target_id", viewonly=True)
|
||||||
|
|
|
@ -9,9 +9,10 @@ class Vote(Base):
|
||||||
|
|
||||||
__tablename__ = "votes"
|
__tablename__ = "votes"
|
||||||
|
|
||||||
user_id = Column(Integer, ForeignKey("users.id"), primary_key=True)
|
id = Column(Integer, primary_key=True)
|
||||||
submission_id = Column(Integer, ForeignKey("submissions.id"), primary_key=True)
|
user_id = Column(Integer, ForeignKey("users.id"))
|
||||||
vote_type = Column(Integer)
|
vote_type = Column(Integer)
|
||||||
|
submission_id = Column(Integer, ForeignKey("submissions.id"))
|
||||||
app_id = Column(Integer, ForeignKey("oauth_apps.id"))
|
app_id = Column(Integer, ForeignKey("oauth_apps.id"))
|
||||||
real = Column(Boolean, default=True)
|
real = Column(Boolean, default=True)
|
||||||
created_utc = Column(Integer)
|
created_utc = Column(Integer)
|
||||||
|
@ -50,9 +51,10 @@ class CommentVote(Base):
|
||||||
|
|
||||||
__tablename__ = "commentvotes"
|
__tablename__ = "commentvotes"
|
||||||
|
|
||||||
user_id = Column(Integer, ForeignKey("users.id"), primary_key=True)
|
id = Column(Integer, primary_key=True)
|
||||||
comment_id = Column(Integer, ForeignKey("comments.id"), primary_key=True)
|
user_id = Column(Integer, ForeignKey("users.id"))
|
||||||
vote_type = Column(Integer)
|
vote_type = Column(Integer)
|
||||||
|
comment_id = Column(Integer, ForeignKey("comments.id"))
|
||||||
app_id = Column(Integer, ForeignKey("oauth_apps.id"))
|
app_id = Column(Integer, ForeignKey("oauth_apps.id"))
|
||||||
real = Column(Boolean, default=True)
|
real = Column(Boolean, default=True)
|
||||||
created_utc = Column(Integer)
|
created_utc = Column(Integer)
|
||||||
|
|
|
@ -100,7 +100,7 @@ def get_post(i, v=None, graceful=False):
|
||||||
items = g.db.query(
|
items = g.db.query(
|
||||||
Submission,
|
Submission,
|
||||||
vt.c.vote_type,
|
vt.c.vote_type,
|
||||||
blocking.c.id,
|
blocking.c.target_id,
|
||||||
)
|
)
|
||||||
|
|
||||||
items=items.filter(Submission.id == i
|
items=items.filter(Submission.id == i
|
||||||
|
@ -154,8 +154,8 @@ def get_posts(pids, v=None):
|
||||||
query = g.db.query(
|
query = g.db.query(
|
||||||
Submission,
|
Submission,
|
||||||
vt.c.vote_type,
|
vt.c.vote_type,
|
||||||
blocking.c.id,
|
blocking.c.target_id,
|
||||||
blocked.c.id,
|
blocked.c.target_id,
|
||||||
).filter(
|
).filter(
|
||||||
Submission.id.in_(pids)
|
Submission.id.in_(pids)
|
||||||
).join(
|
).join(
|
||||||
|
@ -229,8 +229,8 @@ def get_comments(cids, v=None, load_parent=False):
|
||||||
comments = g.db.query(
|
comments = g.db.query(
|
||||||
Comment,
|
Comment,
|
||||||
votes.c.vote_type,
|
votes.c.vote_type,
|
||||||
blocking.c.id,
|
blocking.c.target_id,
|
||||||
blocked.c.id,
|
blocked.c.target_id,
|
||||||
).filter(Comment.id.in_(cids))
|
).filter(Comment.id.in_(cids))
|
||||||
|
|
||||||
if not (v and (v.shadowbanned or v.admin_level > 1)):
|
if not (v and (v.shadowbanned or v.admin_level > 1)):
|
||||||
|
|
|
@ -97,8 +97,8 @@ def post_pid_comment_cid(cid, pid=None, anything=None, v=None, sub=None):
|
||||||
comments = g.db.query(
|
comments = g.db.query(
|
||||||
Comment,
|
Comment,
|
||||||
votes.c.vote_type,
|
votes.c.vote_type,
|
||||||
blocking.c.id,
|
blocking.c.target_id,
|
||||||
blocked.c.id,
|
blocked.c.target_id,
|
||||||
)
|
)
|
||||||
|
|
||||||
if not (v and v.shadowbanned) and not (v and v.admin_level > 1):
|
if not (v and v.shadowbanned) and not (v and v.admin_level > 1):
|
||||||
|
|
|
@ -142,8 +142,8 @@ def post_id(pid, anything=None, v=None, sub=None):
|
||||||
comments = g.db.query(
|
comments = g.db.query(
|
||||||
Comment,
|
Comment,
|
||||||
votes.c.vote_type,
|
votes.c.vote_type,
|
||||||
blocking.c.id,
|
blocking.c.target_id,
|
||||||
blocked.c.id,
|
blocked.c.target_id,
|
||||||
)
|
)
|
||||||
|
|
||||||
if not (v and v.shadowbanned) and not (v and v.admin_level > 1):
|
if not (v and v.shadowbanned) and not (v and v.admin_level > 1):
|
||||||
|
@ -272,8 +272,8 @@ def viewmore(v, pid, sort, offset):
|
||||||
comments = g.db.query(
|
comments = g.db.query(
|
||||||
Comment,
|
Comment,
|
||||||
votes.c.vote_type,
|
votes.c.vote_type,
|
||||||
blocking.c.id,
|
blocking.c.target_id,
|
||||||
blocked.c.id,
|
blocked.c.target_id,
|
||||||
).filter(Comment.parent_submission == pid, Comment.author_id.notin_((AUTOPOLLER_ID, AUTOBETTER_ID, AUTOCHOICE_ID)), Comment.is_pinned == None, Comment.id.notin_(ids))
|
).filter(Comment.parent_submission == pid, Comment.author_id.notin_((AUTOPOLLER_ID, AUTOBETTER_ID, AUTOCHOICE_ID)), Comment.is_pinned == None, Comment.id.notin_(ids))
|
||||||
|
|
||||||
if not (v and v.shadowbanned) and not (v and v.admin_level > 1):
|
if not (v and v.shadowbanned) and not (v and v.admin_level > 1):
|
||||||
|
@ -375,8 +375,8 @@ def morecomments(v, cid):
|
||||||
comments = g.db.query(
|
comments = g.db.query(
|
||||||
Comment,
|
Comment,
|
||||||
votes.c.vote_type,
|
votes.c.vote_type,
|
||||||
blocking.c.id,
|
blocking.c.target_id,
|
||||||
blocked.c.id,
|
blocked.c.target_id,
|
||||||
).filter(Comment.top_comment_id == tcid, Comment.level > 9).join(
|
).filter(Comment.top_comment_id == tcid, Comment.level > 9).join(
|
||||||
votes,
|
votes,
|
||||||
votes.c.comment_id == Comment.id,
|
votes.c.comment_id == Comment.id,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue