Aevann1 2022-06-26 06:57:31 +02:00
parent db70452d84
commit ecc22cfc06
2 changed files with 7 additions and 5 deletions

View File

@ -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()
return g.db.query(CommentSaveRelationship).filter_by(user_id=v.id, comment_id=self.id).first()

View File

@ -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()
return g.db.query(SaveRelationship).filter_by(user_id=v.id, submission_id=self.id).first()