This commit is contained in:
Aevann1 2021-09-23 19:28:30 +02:00
parent 9c6e639280
commit 577eb12d5f
4 changed files with 7 additions and 6 deletions

View file

@ -46,7 +46,7 @@ class Submission(Base):
deleted_utc = Column(Integer, default=0) deleted_utc = Column(Integer, default=0)
distinguish_level = Column(Integer, default=0) distinguish_level = Column(Integer, default=0)
created_str = Column(String(255)) created_str = Column(String(255))
stickied = Column(Boolean, default=False) stickied = Column(String)
is_pinned = Column(Boolean, default=False) is_pinned = Column(Boolean, default=False)
private = Column(Boolean, default=False) private = Column(Boolean, default=False)
club = Column(Boolean, default=False) club = Column(Boolean, default=False)

View file

@ -971,7 +971,7 @@ def ban_post(post_id, v):
post.is_banned = True post.is_banned = True
post.is_approved = 0 post.is_approved = 0
post.stickied = False post.stickied = None
post.is_pinned = False post.is_pinned = False
post.removed_by = v.id post.removed_by = v.id
@ -1066,7 +1066,8 @@ def api_sticky_post(post_id, v):
post = g.db.query(Submission).options(lazyload('*')).filter_by(id=post_id).first() post = g.db.query(Submission).options(lazyload('*')).filter_by(id=post_id).first()
if post: if post:
post.stickied = not (post.stickied) if post.stickied: post.stickied = None
else: post.stickied = v.username
g.db.add(post) g.db.add(post)
ma=ModAction( ma=ModAction(

View file

@ -131,7 +131,7 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, filter_words='
cutoff = now - 31536000 cutoff = now - 31536000
posts = posts.filter(Submission.created_utc >= cutoff) posts = posts.filter(Submission.created_utc >= cutoff)
posts = posts.filter_by(is_banned=False,stickied=False,private=False,deleted_utc = 0) posts = posts.filter_by(is_banned=False, stickied=None, private=False, deleted_utc = 0)
if v: if v:
posts = posts.filter(or_(Submission.processing == False, Submission.author_id == v.id)) posts = posts.filter(or_(Submission.processing == False, Submission.author_id == v.id))
@ -198,7 +198,7 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, filter_words='
posts = posts[:25] posts = posts[:25]
if page == 1: posts = g.db.query(Submission).options(lazyload('*')).filter_by(stickied=True).all() + posts if page == 1: posts = g.db.query(Submission).options(lazyload('*')).filter(Submission.stickied != None).all() + posts
if ids_only: posts = [x.id for x in posts] if ids_only: posts = [x.id for x in posts]

View file

@ -1100,7 +1100,7 @@ def delete_post_pid(pid, v):
post.deleted_utc = int(time.time()) post.deleted_utc = int(time.time())
post.is_pinned = False post.is_pinned = False
post.stickied = False post.stickied = None
g.db.add(post) g.db.add(post)