dfsfsd
This commit is contained in:
parent
5fae115060
commit
6b7ae51d61
5 changed files with 16 additions and 4 deletions
|
@ -88,6 +88,7 @@ class Badge(Base):
|
|||
'icon_url':f"https://{app.config['SERVER_NAME']}{self.path}"
|
||||
}
|
||||
|
||||
property
|
||||
@property
|
||||
@lazy
|
||||
def json(self):
|
||||
return self.json_core
|
||||
|
|
|
@ -36,7 +36,7 @@ class OauthApp(Base):
|
|||
@lazy
|
||||
def permalink(self): return f"/admin/app/{self.id}"
|
||||
|
||||
|
||||
@lazy
|
||||
def idlist(self, page=1, **kwargs):
|
||||
|
||||
posts = g.db.query(Submission.id).options(lazyload('*')).options(lazyload('*')).filter_by(app_id=self.id)
|
||||
|
@ -47,7 +47,7 @@ class OauthApp(Base):
|
|||
|
||||
return [x[0] for x in posts.all()]
|
||||
|
||||
|
||||
@lazy
|
||||
def comments_idlist(self, page=1, **kwargs):
|
||||
|
||||
posts = g.db.query(Comment.id).options(lazyload('*')).options(lazyload('*')).filter_by(app_id=self.id)
|
||||
|
|
|
@ -327,6 +327,7 @@ class Comment(Base):
|
|||
self.comment_aux.body_html = x
|
||||
g.db.add(self.comment_aux)
|
||||
|
||||
@lazy
|
||||
def realbody(self, v):
|
||||
if self.post and self.post.club and not (v and v.paid_dues): return "<p>COUNTRY CLUB ONLY</p>"
|
||||
body = self.comment_aux.body_html
|
||||
|
@ -365,6 +366,7 @@ class Comment(Base):
|
|||
#def award_count(self):
|
||||
#return len(self.awards)
|
||||
|
||||
@lazy
|
||||
def collapse_for_user(self, v):
|
||||
|
||||
if self.over_18 and not (v and v.over_18) and not self.post.over_18:
|
||||
|
|
|
@ -209,6 +209,7 @@ class Submission(Base):
|
|||
|
||||
return f"/post/{self.id}/{output}"
|
||||
|
||||
@lazy
|
||||
def rendered_page(self, sort=None, last_view_utc=None, comment=None, comment_info=None, v=None):
|
||||
|
||||
# check for banned
|
||||
|
@ -282,7 +283,7 @@ class Submission(Base):
|
|||
else: return f"https://{site}/assets/images/default_thumb_link.webp"
|
||||
|
||||
@property
|
||||
|
||||
@lazy
|
||||
def json_raw(self):
|
||||
flags = {}
|
||||
for f in self.flags: flags[f.user.username] = f.reason
|
||||
|
@ -383,6 +384,7 @@ class Submission(Base):
|
|||
self.submission_aux.url = x
|
||||
g.db.add(self.submission_aux)
|
||||
|
||||
@lazy
|
||||
def realurl(self, v):
|
||||
if v and v.agendaposter and random.randint(1, 10) < 4:
|
||||
return 'https://secure.actblue.com/donate/ms_blm_homepage_2019'
|
||||
|
@ -416,6 +418,7 @@ class Submission(Base):
|
|||
self.submission_aux.body_html = x
|
||||
g.db.add(self.submission_aux)
|
||||
|
||||
@lazy
|
||||
def realbody(self, v):
|
||||
if self.club and not (v and v.paid_dues): return "COUNTRY CLUB ONLY"
|
||||
body = self.submission_aux.body_html
|
||||
|
@ -437,6 +440,7 @@ class Submission(Base):
|
|||
self.submission_aux.title_html = x
|
||||
g.db.add(self.submission_aux)
|
||||
|
||||
@lazy
|
||||
def realtitle(self, v):
|
||||
if self.club and not (v and v.paid_dues) and not (v and v.admin_level == 6): return 'COUNTRY CLUB MEMBERS ONLY'
|
||||
elif self.title_html: title = self.title_html
|
||||
|
|
|
@ -417,6 +417,7 @@ class User(Base):
|
|||
|
||||
return output
|
||||
|
||||
@lazy
|
||||
def alts_threaded(self, db):
|
||||
|
||||
subq = db.query(Alt).filter(
|
||||
|
@ -531,6 +532,7 @@ class User(Base):
|
|||
|
||||
g.db.add(self)
|
||||
|
||||
|
||||
def unban(self):
|
||||
|
||||
self.is_banned = 0
|
||||
|
@ -562,10 +564,12 @@ class User(Base):
|
|||
return [x for x in self._applications.order_by(
|
||||
OauthApp.id.asc()).all()]
|
||||
|
||||
@lazy
|
||||
def subscribed_idlist(self, page=1):
|
||||
posts = g.db.query(Subscription.submission_id).options(lazyload('*')).filter_by(user_id=self.id).all()
|
||||
return [x[0] for x in posts]
|
||||
|
||||
@lazy
|
||||
def saved_idlist(self, page=1):
|
||||
|
||||
posts = g.db.query(Submission.id).options(lazyload('*')).options(lazyload('*')).filter_by(is_banned=False,
|
||||
|
@ -592,6 +596,7 @@ class User(Base):
|
|||
|
||||
return [x[0] for x in posts.offset(25 * (page - 1)).limit(26).all()]
|
||||
|
||||
@lazy
|
||||
def saved_comment_idlist(self, page=1):
|
||||
|
||||
comments = g.db.query(Comment.id).options(lazyload('*')).options(lazyload('*')).filter_by(is_banned=False, deleted_utc=0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue