diff --git a/files/classes/comment.py b/files/classes/comment.py index 957741f0e..cd5cc8154 100644 --- a/files/classes/comment.py +++ b/files/classes/comment.py @@ -12,8 +12,9 @@ from files.helpers.regex import * from files.helpers.regex import * from files.helpers.lazy import lazy from .flags import CommentFlag -from random import randint from .votes import CommentVote +from .saves import CommentSaveRelationship +from random import randint from math import floor @@ -566,4 +567,4 @@ class Comment(Base): @lazy def is_saved(self, v): - return g.db.query(SaveRelationship).filter_by(user_id=v.id, submission_id=self.id).first() \ No newline at end of file + return g.db.query(CommentSaveRelationship).filter_by(user_id=v.id, comment_id=self.id).first() \ No newline at end of file diff --git a/files/classes/submission.py b/files/classes/submission.py index 5ab95d88b..290cb87a8 100644 --- a/files/classes/submission.py +++ b/files/classes/submission.py @@ -12,10 +12,10 @@ from files.helpers.regex import * from files.helpers.lazy import lazy from .flags import Flag from .comment import Comment, normalize_urls_runtime -from flask import g +from .saves import SaveRelationship from .sub import * from .votes import CommentVote - +from flask import g def sort_posts(sort, posts): if sort == "new": @@ -504,6 +504,7 @@ class Submission(Base): def active_flags(self, v): return len(self.flags(v)) + @lazy def is_saved(self, v): - return g.db.query(CommentSaveRelationship).filter_by(user_id=v.id, comment_id=self.id).first() \ No newline at end of file + return g.db.query(SaveRelationship).filter_by(user_id=v.id, submission_id=self.id).first()