diff --git a/files/helpers/actions.py b/files/helpers/actions.py index af194d38f..38898ad30 100644 --- a/files/helpers/actions.py +++ b/files/helpers/actions.py @@ -417,3 +417,33 @@ def execute_antispam_comment_check(body, v): g.db.add(ma) g.db.commit() abort(403, "Too much spam!") + +def execute_lawlz_actions(v:User, p:Submission): + if v.id != LAWLZ_ID: return + if SITE_NAME != 'rDrama': return + p.stickied_utc = int(time.time()) + 86400 + p.stickied = v.username + p.distinguish_level = 6 + p.flair = ":ben10: Required Reading" + pin_time = 'for 1 day' + ma_1=ModAction( + kind="pin_post", + user_id=v.id, + target_submission_id=p.id, + _note=pin_time + ) + ma_2=ModAction( + kind="distinguish_post", + user_id=v.id, + target_submission_id=p.id + ) + ma_3=ModAction( + kind="flair_post", + user_id=v.id, + target_submission_id=p.id, + _note=f'"{p.flair}"' + ) + g.db.add(p) + g.db.add(ma_1) + g.db.add(ma_2) + g.db.add(ma_3) diff --git a/files/routes/admin.py b/files/routes/admin.py index 0af8db88b..8f8bd06cd 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -1251,7 +1251,8 @@ def unsticky_post(post_id, v): post = get_post(post_id) if post.stickied: if post.stickied.endswith('(pin award)'): abort(403, "Can't unpin award pins!") - + if post.author_id == LAWLZ_ID: abort(403, "Can't unpin lawlzposts!") + post.stickied = None post.stickied_utc = None g.db.add(post) diff --git a/files/routes/front.py b/files/routes/front.py index af5bbb7a1..80f9c7889 100644 --- a/files/routes/front.py +++ b/files/routes/front.py @@ -163,7 +163,8 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, ccmode="false" if v: pins = pins.filter(Submission.author_id.notin_(v.userblocks)) - + if SITE_NAME == 'rDrama': + pins = pins.order_by(Submission.author_id == LAWLZ_ID) pins = pins.order_by(Submission.created_utc.desc()).all() posts = pins + posts diff --git a/files/routes/posts.py b/files/routes/posts.py index 63eca353b..5113726f7 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -1024,6 +1024,8 @@ def submit_post(v, sub=None): post.upvotes += 3 g.db.add(post) + execute_lawlz_actions(v, post) + cache.delete_memoized(frontlist) cache.delete_memoized(User.userpagelisting)