From ecc22cfc068154990c460ff4d396b094fdc97b8a Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 26 Jun 2022 06:57:31 +0200 Subject: [PATCH] fix 2b1e7f65708eaa219300d9341f3b5de865417a31 --- files/classes/comment.py | 5 +++-- files/classes/submission.py | 7 ++++--- 2 files changed, 7 insertions(+), 5 deletions(-) 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()