remotes/1693045480750635534/spooky-22
Aevann1 2021-09-23 19:28:30 +02:00
parent 93fa545ffb
commit b4287b2477
4 changed files with 7 additions and 6 deletions

View File

@ -46,7 +46,7 @@ class Submission(Base):
deleted_utc = Column(Integer, default=0)
distinguish_level = Column(Integer, default=0)
created_str = Column(String(255))
stickied = Column(Boolean, default=False)
stickied = Column(String)
is_pinned = Column(Boolean, default=False)
private = 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_approved = 0
post.stickied = False
post.stickied = None
post.is_pinned = False
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()
if post:
post.stickied = not (post.stickied)
if post.stickied: post.stickied = None
else: post.stickied = v.username
g.db.add(post)
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
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:
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]
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]

View File

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