From cec1994ff70d16b7dec86ae391dfb886fc6bd85e Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Mon, 13 Jun 2022 23:41:29 +0200 Subject: [PATCH] ppl with code contributor badge can now make "(changelog)" posts --- files/routes/front.py | 6 ++++-- files/routes/posts.py | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/files/routes/front.py b/files/routes/front.py index dca383623..48b1db5fb 100644 --- a/files/routes/front.py +++ b/files/routes/front.py @@ -383,8 +383,10 @@ def changeloglist(v=None, sort="new", page=1, t="all", site=None): posts = posts.filter(Submission.author_id.notin_(v.userblocks)) - admins = [x[0] for x in g.db.query(User.id).filter(User.admin_level > 0).all()] - posts = posts.filter(Submission.title.ilike('_changelog%'), Submission.author_id.in_(admins)) + allowed = g.db.query(User.id).filter(User.admin_level > 0).all() + g.db.query(Badge.user_id).filter_by(badge_id=3).all() + allowed = [x[0] for x in allowed] + + posts = posts.filter(Submission.title.ilike('_changelog%'), Submission.author_id.in_(allowed)) if t != 'all': cutoff = 0 diff --git a/files/routes/posts.py b/files/routes/posts.py index fe3b54166..0a26ba53a 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -100,7 +100,7 @@ def publish(pid, v): cache.delete_memoized(frontlist) cache.delete_memoized(User.userpagelisting) - if v.admin_level > 0 and ("[changelog]" in post.title.lower() or "(changelog)" in post.title.lower()): + if (v.admin_level > 0 or v.has_badge(3)) and ("[changelog]" in post.title.lower() or "(changelog)" in post.title.lower()): send_discord_message(post.permalink) cache.delete_memoized(changeloglist) @@ -1292,7 +1292,7 @@ def submit_post(v, sub=None): cache.delete_memoized(frontlist) cache.delete_memoized(User.userpagelisting) - if v.admin_level > 0 and ("[changelog]" in post.title.lower() or "(changelog)" in post.title.lower()) and not post.private: + if (v.admin_level > 0 or v.has_badge(3)) and ("[changelog]" in post.title.lower() or "(changelog)" in post.title.lower()) and not post.private: send_discord_message(post.permalink) cache.delete_memoized(changeloglist)