fdfd
This commit is contained in:
parent
b5363997f8
commit
7a66f91f13
2 changed files with 7 additions and 7 deletions
|
@ -160,7 +160,7 @@ class User(Base, Stndrd, Age_times):
|
||||||
def strid(self):
|
def strid(self):
|
||||||
return str(self.id)
|
return str(self.id)
|
||||||
|
|
||||||
@cache.memoize()
|
@cache.memoize(timeout=86400)
|
||||||
def userpagelisting(self, v=None, page=1, sort="new", t="all"):
|
def userpagelisting(self, v=None, page=1, sort="new", t="all"):
|
||||||
|
|
||||||
submissions = g.db.query(Submission).options(lazyload('*')).filter_by(author_id=self.id, is_pinned=False)
|
submissions = g.db.query(Submission).options(lazyload('*')).filter_by(author_id=self.id, is_pinned=False)
|
||||||
|
@ -202,7 +202,7 @@ class User(Base, Stndrd, Age_times):
|
||||||
listing = [x.id for x in submissions[firstrange:secondrange]]
|
listing = [x.id for x in submissions[firstrange:secondrange]]
|
||||||
return listing
|
return listing
|
||||||
|
|
||||||
@cache.memoize()
|
@cache.memoize(timeout=86400)
|
||||||
def commentlisting(self, v=None, page=1, sort="new", t="all"):
|
def commentlisting(self, v=None, page=1, sort="new", t="all"):
|
||||||
comments = self.comments.options(lazyload('*')).filter(Comment.parent_submission != None).join(Comment.post)
|
comments = self.comments.options(lazyload('*')).filter(Comment.parent_submission != None).join(Comment.post)
|
||||||
|
|
||||||
|
@ -350,7 +350,7 @@ class User(Base, Stndrd, Age_times):
|
||||||
return self.notifications.filter(Notification.read == False).join(Notification.comment).filter(
|
return self.notifications.filter(Notification.read == False).join(Notification.comment).filter(
|
||||||
Comment.author_id == AUTOJANNY_ACCOUNT).count()
|
Comment.author_id == AUTOJANNY_ACCOUNT).count()
|
||||||
|
|
||||||
@cache.memoize()
|
@cache.memoize(timeout=86400)
|
||||||
def notification_messages(self, page=1):
|
def notification_messages(self, page=1):
|
||||||
|
|
||||||
if self.admin_level == 6: comments = g.db.query(Comment).filter(or_(Comment.author_id==self.id, Comment.sentto==self.id, Comment.sentto==0)).filter(Comment.parent_submission == None).order_by(Comment.created_utc.desc()).limit(100).all()
|
if self.admin_level == 6: comments = g.db.query(Comment).filter(or_(Comment.author_id==self.id, Comment.sentto==self.id, Comment.sentto==0)).filter(Comment.parent_submission == None).order_by(Comment.created_utc.desc()).limit(100).all()
|
||||||
|
@ -488,7 +488,7 @@ class User(Base, Stndrd, Age_times):
|
||||||
if self.bannerurl: return self.bannerurl
|
if self.bannerurl: return self.bannerurl
|
||||||
else: return f"https://{site}/assets/images/default_bg.gif"
|
else: return f"https://{site}/assets/images/default_bg.gif"
|
||||||
|
|
||||||
@cache.memoize()
|
@cache.memoize(timeout=86400)
|
||||||
def defaultpicture(self):
|
def defaultpicture(self):
|
||||||
pic = random.randint(1, 150)
|
pic = random.randint(1, 150)
|
||||||
return f"https://{site}/assets/images/defaultpictures/{pic}.gif"
|
return f"https://{site}/assets/images/defaultpictures/{pic}.gif"
|
||||||
|
|
|
@ -72,7 +72,7 @@ def notifications(v):
|
||||||
render_replies=True,
|
render_replies=True,
|
||||||
is_notification_page=True)
|
is_notification_page=True)
|
||||||
|
|
||||||
@cache.memoize()
|
@cache.memoize(timeout=86400)
|
||||||
def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, filter_words='', **kwargs):
|
def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, filter_words='', **kwargs):
|
||||||
|
|
||||||
posts = g.db.query(Submission).options(lazyload('*'))
|
posts = g.db.query(Submission).options(lazyload('*'))
|
||||||
|
@ -226,7 +226,7 @@ def front_all(v):
|
||||||
if request.headers.get("Authorization"): return {"data": [x.json for x in posts], "next_exists": next_exists}
|
if request.headers.get("Authorization"): return {"data": [x.json for x in posts], "next_exists": next_exists}
|
||||||
else: return render_template("home.html", v=v, listing=posts, next_exists=next_exists, sort=sort, t=t, page=page)
|
else: return render_template("home.html", v=v, listing=posts, next_exists=next_exists, sort=sort, t=t, page=page)
|
||||||
|
|
||||||
@cache.memoize()
|
@cache.memoize(timeout=86400)
|
||||||
def changeloglist(v=None, sort="new", page=1 ,t="all", **kwargs):
|
def changeloglist(v=None, sort="new", page=1 ,t="all", **kwargs):
|
||||||
|
|
||||||
posts = g.db.query(Submission).options(lazyload('*')).filter_by(is_banned=False, private=False,).filter(Submission.deleted_utc == 0)
|
posts = g.db.query(Submission).options(lazyload('*')).filter_by(is_banned=False, private=False,).filter(Submission.deleted_utc == 0)
|
||||||
|
@ -340,7 +340,7 @@ def random_post(v):
|
||||||
post = x.order_by(Submission.id.asc()).offset(n).limit(1).first()
|
post = x.order_by(Submission.id.asc()).offset(n).limit(1).first()
|
||||||
return redirect(post.permalink)
|
return redirect(post.permalink)
|
||||||
|
|
||||||
@cache.memoize()
|
@cache.memoize(timeout=86400)
|
||||||
def comment_idlist(page=1, v=None, nsfw=False, sort="new", t="all", **kwargs):
|
def comment_idlist(page=1, v=None, nsfw=False, sort="new", t="all", **kwargs):
|
||||||
|
|
||||||
posts = g.db.query(Submission).options(lazyload('*'))
|
posts = g.db.query(Submission).options(lazyload('*'))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue