forked from MarseyWorld/MarseyWorld
fdsfds
parent
5fdd807363
commit
9dbcbc9cd5
|
@ -399,7 +399,8 @@ class SaveRelationship(Base):
|
|||
|
||||
__tablename__="save_relationship"
|
||||
|
||||
id=Column(Integer, primary_key=true)
|
||||
user_id=Column(Integer, ForeignKey("users.id"))
|
||||
submission_id=Column(Integer, ForeignKey("submissions.id"))
|
||||
id=Column(Integer, primary_key=True)
|
||||
user_id=Column(Integer)
|
||||
submission_id=Column(Integer)
|
||||
comment_id=Column(Integer)
|
||||
type=Column(Integer)
|
|
@ -537,7 +537,7 @@ class User(Base):
|
|||
|
||||
def saved_comment_idlist(self):
|
||||
|
||||
saved = [x[0] for x in g.db.query(SaveRelationship.submission_id).options(lazyload('*')).filter(SaveRelationship.user_id == self.id).all()]
|
||||
saved = [x[0] for x in g.db.query(SaveRelationship.comment_id).options(lazyload('*')).filter(SaveRelationship.user_id == self.id).all()]
|
||||
comments = g.db.query(Comment.id).options(lazyload('*')).filter(Comment.id.in_(saved))
|
||||
|
||||
if self.admin_level == 0:
|
||||
|
|
|
@ -844,10 +844,10 @@ def save_comment(cid, v):
|
|||
|
||||
comment=get_comment(cid)
|
||||
|
||||
save=g.db.query(SaveRelationship).options(lazyload('*')).filter_by(user_id=v.id, submission_id=comment.id, type=2).first()
|
||||
save=g.db.query(SaveRelationship).options(lazyload('*')).filter_by(user_id=v.id, comment_id=comment.id, type=2).first()
|
||||
|
||||
if not save:
|
||||
new_save=SaveRelationship(user_id=v.id, submission_id=comment.id, type=2)
|
||||
new_save=SaveRelationship(user_id=v.id, comment_id=comment.id, type=2)
|
||||
g.db.add(new_save)
|
||||
try: g.db.commit()
|
||||
except: g.db.rollback()
|
||||
|
@ -862,7 +862,7 @@ def unsave_comment(cid, v):
|
|||
|
||||
comment=get_comment(cid)
|
||||
|
||||
save=g.db.query(SaveRelationship).options(lazyload('*')).filter_by(user_id=v.id, submission_id=comment.id, type=2).first()
|
||||
save=g.db.query(SaveRelationship).options(lazyload('*')).filter_by(user_id=v.id, comment_id=comment.id, type=2).first()
|
||||
|
||||
if save:
|
||||
g.db.delete(save)
|
||||
|
|
Loading…
Reference in New Issue