diff --git a/files/classes/comment.py b/files/classes/comment.py index b115028268..975264e7dc 100644 --- a/files/classes/comment.py +++ b/files/classes/comment.py @@ -13,8 +13,8 @@ from .flags import CommentFlag from random import randint site = environ.get("DOMAIN").strip() -if site == 'pcmemes.net': cc = "splash mountain" -else: cc = "country club" +if site == 'pcmemes.net': cc = "SPLASH MOUNTAIN" +else: cc = "COUNTRY CLUB" class Comment(Base): @@ -305,7 +305,7 @@ class Comment(Base): return data def realbody(self, v): - if self.post and self.post.club and not (v and v.paid_dues): return f"

{cc} ONLY

" + if self.post and self.post.club and not (v and v.paid_dues) and not (v and v.id == self.author_id): return f"

{cc} ONLY

" body = self.body_html @@ -342,7 +342,7 @@ class Comment(Base): return body def plainbody(self, v): - if self.post and self.post.club and not (v and v.paid_dues): return f"

{cc} ONLY

" + if self.post and self.post.club and not (v and v.paid_dues) and not (v and v.id == self.author_id): return f"

{cc} ONLY

" body = self.body diff --git a/files/classes/mod_logs.py b/files/classes/mod_logs.py index e2310965e5..e2ec233f6d 100644 --- a/files/classes/mod_logs.py +++ b/files/classes/mod_logs.py @@ -6,8 +6,8 @@ from files.helpers.lazy import lazy from os import environ site = environ.get("DOMAIN").strip() -if site == 'pcmemes.net': cc = "splash mountain" -else: cc = "country club" +if site == 'pcmemes.net': cc = "SPLASH MOUNTAIN" +else: cc = "COUNTRY CLUB" class ModAction(Base): __tablename__ = "modactions" @@ -82,7 +82,7 @@ class ModAction(Base): @lazy def string(self): - output = ACTIONTYPES[self.kind]["str"].format(self=self, cc=cc) + output = ACTIONTYPES[self.kind]["str"].format(self=self) if self.note: output += f" ({self.note})" @@ -93,7 +93,7 @@ class ModAction(Base): def target_link(self): if self.target_user: return f'{self.target_user.username}' elif self.target_post: - if self.target_post.club: return f'{cc.upper()} ONLY' + if self.target_post.club: return f'{cc} ONLY' return f'{self.target_post.title.replace("<","").replace(">","")}' elif self.target_comment_id: return f'comment' diff --git a/files/routes/admin.py b/files/routes/admin.py index 08abf81eb3..edd32391e3 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -1016,8 +1016,7 @@ def api_ban_comment(c_id, v): def api_unban_comment(c_id, v): comment = g.db.query(Comment).filter_by(id=c_id).first() - if not comment: - abort(404) + if not comment: abort(404) g.db.add(comment) if comment.is_banned: @@ -1037,26 +1036,20 @@ def api_unban_comment(c_id, v): @app.post("/distinguish_comment/") -@auth_required +@admin_level_required(1) def admin_distinguish_comment(c_id, v): - if v.admin_level == 0: abort(403) comment = get_comment(c_id, v=v) - if comment.author_id != v.id: - abort(403) + if comment.author_id != v.id: abort(403) comment.distinguish_level = 0 if comment.distinguish_level else v.admin_level g.db.add(comment) - html=render_template( - "comments.html", - v=v, - comments=[comment], - ) + html = render_template("comments.html", v=v, comments=[comment]) - html=str(BeautifulSoup(html, features="html.parser").find(id=f"comment-{comment.id}-only")) + html = str(BeautifulSoup(html, features="html.parser").find(id=f"comment-{comment.id}-only")) g.db.commit() diff --git a/files/routes/users.py b/files/routes/users.py index 2f9aa8b5cf..7bd6491772 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -646,17 +646,13 @@ def u_username_comments(username, v=None): if request.headers.get("Authorization"): return {"error": "That userpage is private"} else: return render_template("userpage_private.html", time=int(time.time()), u=u, v=v) - if hasattr(u, 'is_blocking') and u.is_blocking and (not v or v.admin_level < 2): + if v and hasattr(u, 'is_blocking') and u.is_blocking: if request.headers.get("Authorization"): return {"error": f"You are blocking @{u.username}."} - else: return render_template("userpage_blocking.html", - u=u, - v=v) + else: return render_template("userpage_blocking.html", u=u, v=v) - if hasattr(u, 'is_blocked') and u.is_blocked and (not v or v.admin_level < 2): + if v and v.admin_level < 2 and hasattr(u, 'is_blocked') and u.is_blocked: if request.headers.get("Authorization"): return {"error": "This person is blocking you."} - else: return render_template("userpage_blocked.html", - u=u, - v=v) + else: return render_template("userpage_blocked.html", u=u, v=v) page = int(request.values.get("page", "1")) diff --git a/files/templates/admin/image_posts.html b/files/templates/admin/image_posts.html index a8aa147562..c248b3667d 100644 --- a/files/templates/admin/image_posts.html +++ b/files/templates/admin/image_posts.html @@ -12,28 +12,27 @@ {% block fixedMobileBarJS %} {% endblock %} diff --git a/files/templates/admin/reported_posts.html b/files/templates/admin/reported_posts.html index a748c65bcc..08c3a0c531 100644 --- a/files/templates/admin/reported_posts.html +++ b/files/templates/admin/reported_posts.html @@ -40,28 +40,27 @@ {% block fixedMobileBarJS %} {% endblock %} diff --git a/files/templates/authforms.html b/files/templates/authforms.html index cc66fec5e0..019abbb7eb 100644 --- a/files/templates/authforms.html +++ b/files/templates/authforms.html @@ -15,11 +15,11 @@ {% if v %} - + {% if v.agendaposter %}{% elif v.css %}{% endif %} {% else %} - + {% endif %} diff --git a/files/templates/ban_modal.html b/files/templates/ban_modal.html index 9b0739a227..6c0e2e8d9e 100644 --- a/files/templates/ban_modal.html +++ b/files/templates/ban_modal.html @@ -1,30 +1,27 @@ - + - + {% if v.agendaposter %}{% elif v.css %}{% endif %} {% else %} - + {% endif %}
diff --git a/files/templates/login.html b/files/templates/login.html index 9cec011dfc..07ac140aba 100644 --- a/files/templates/login.html +++ b/files/templates/login.html @@ -114,7 +114,7 @@
- + diff --git a/files/templates/login_2fa.html b/files/templates/login_2fa.html index 2de28f201c..1a42640b8a 100644 --- a/files/templates/login_2fa.html +++ b/files/templates/login_2fa.html @@ -12,7 +12,7 @@ 2-Step Login - {{'SITE_NAME' | app_config}} - + diff --git a/files/templates/settings2.html b/files/templates/settings2.html index 7bf00f4edb..affd9cfed1 100644 --- a/files/templates/settings2.html +++ b/files/templates/settings2.html @@ -36,10 +36,10 @@ {% if v %} - + {% else %} - + {% endif %} @@ -168,7 +168,7 @@ {% block scripts %} {% endblock %} - +
diff --git a/files/templates/settings_css.html b/files/templates/settings_css.html index 8731cbaaa2..760b14214f 100644 --- a/files/templates/settings_css.html +++ b/files/templates/settings_css.html @@ -38,15 +38,15 @@
{% if v.agendaposter %} {% endif %} diff --git a/files/templates/settings_security.html b/files/templates/settings_security.html index b0a4b487cc..5d1fd41690 100644 --- a/files/templates/settings_security.html +++ b/files/templates/settings_security.html @@ -5,16 +5,14 @@ {% block content %}
diff --git a/files/templates/sign_up.html b/files/templates/sign_up.html index e7b05cc0c7..c84ad296b8 100644 --- a/files/templates/sign_up.html +++ b/files/templates/sign_up.html @@ -28,7 +28,7 @@ - + @@ -146,7 +146,7 @@
- + diff --git a/files/templates/sign_up_failed_ref.html b/files/templates/sign_up_failed_ref.html index 06194c7d4e..7e2007bcc0 100644 --- a/files/templates/sign_up_failed_ref.html +++ b/files/templates/sign_up_failed_ref.html @@ -29,7 +29,7 @@ - + @@ -96,7 +96,7 @@ - + diff --git a/files/templates/submission_banned.html b/files/templates/submission_banned.html index 7f591e9e44..03cc544acf 100644 --- a/files/templates/submission_banned.html +++ b/files/templates/submission_banned.html @@ -25,7 +25,7 @@ {% endif %} -{% if v.admin_level > 1 and v.id==p.author_id %} +{% if v.admin_level > 0 and v.id==p.author_id %}
diff --git a/files/templates/submit.html b/files/templates/submit.html index e01bf1cc4b..78b0b20753 100644 --- a/files/templates/submit.html +++ b/files/templates/submit.html @@ -23,11 +23,11 @@ {% block stylesheets %} {% if v %} - + {% if v.agendaposter %}{% elif v.css %}{% endif %} {% else %} - + {% endif %} {% endblock %} @@ -173,7 +173,7 @@ {% endblock %} - + diff --git a/files/templates/userpage.html b/files/templates/userpage.html index 4d25e2aedd..bced9f259e 100644 --- a/files/templates/userpage.html +++ b/files/templates/userpage.html @@ -35,7 +35,6 @@ {% if v %} + {% endif %} {% if u.song %} + {% endif %}
diff --git a/files/templates/userpage_blocked.html b/files/templates/userpage_blocked.html index 54e6f85ef3..57edf0954f 100644 --- a/files/templates/userpage_blocked.html +++ b/files/templates/userpage_blocked.html @@ -4,28 +4,27 @@ {% block fixedMobileBarJS %} {% endblock %} diff --git a/files/templates/userpage_blocking.html b/files/templates/userpage_blocking.html index 51cf27d307..3355d36c14 100644 --- a/files/templates/userpage_blocking.html +++ b/files/templates/userpage_blocking.html @@ -4,28 +4,27 @@ {% block fixedMobileBarJS %} {% endblock %} diff --git a/files/templates/userpage_reserved.html b/files/templates/userpage_reserved.html index fd2f335d09..b30d552060 100644 --- a/files/templates/userpage_reserved.html +++ b/files/templates/userpage_reserved.html @@ -4,28 +4,27 @@ {% block fixedMobileBarJS %} {% endblock %}