sdfsdf
This commit is contained in:
parent
2b11dee894
commit
0cbe982fd8
6 changed files with 21 additions and 23 deletions
|
@ -2,16 +2,18 @@ import re
|
|||
from urllib.parse import urlencode, urlparse, parse_qs
|
||||
from flask import *
|
||||
from sqlalchemy import *
|
||||
from sqlalchemy.orm import relationship, deferred
|
||||
from sqlalchemy.orm import relationship, deferred, lazyload
|
||||
from files.helpers.lazy import lazy
|
||||
from files.helpers.const import SLURS
|
||||
from files.__main__ import Base
|
||||
from .flags import CommentFlag
|
||||
from .user import User
|
||||
from os import environ
|
||||
import time
|
||||
|
||||
site = environ.get("DOMAIN").strip()
|
||||
|
||||
shadowbanned = [x[0] for x in g.db.query(User.id).options(lazyload('*')).filter(User.shadowbanned != None).all()]
|
||||
|
||||
class Comment(Base):
|
||||
|
||||
|
@ -357,12 +359,12 @@ class Comment(Base):
|
|||
|
||||
@property
|
||||
@lazy
|
||||
def active_flags(self): return self.flags.count()
|
||||
def active_flags(self): return self.ordered_flags.count()
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def ordered_flags(self): return self.flags.order_by(CommentFlag.id).all()
|
||||
|
||||
def ordered_flags(self):
|
||||
return self.flags.filter(CommentFlag.user_id.notin_(shadowbanned)).order_by(CommentFlag.id).all()
|
||||
|
||||
|
||||
class Notification(Base):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue