From f066ab94c9a329b47deaf438bca0ce848ae64902 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Thu, 2 Dec 2021 20:45:03 +0200 Subject: [PATCH] dsads --- files/classes/comment.py | 4 ++-- files/classes/submission.py | 8 ++++---- files/routes/comments.py | 4 ++-- files/routes/posts.py | 2 +- files/templates/submission_listing.html | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/files/classes/comment.py b/files/classes/comment.py index 975264e7d..d4c706336 100644 --- a/files/classes/comment.py +++ b/files/classes/comment.py @@ -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) and not (v and v.id == self.author_id): return f"

{cc} ONLY

" + if self.post and self.post.club and not (v and (v.paid_dues or 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) and not (v and v.id == self.author_id): return f"

{cc} ONLY

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

{cc} ONLY

" body = self.body diff --git a/files/classes/submission.py b/files/classes/submission.py index 678110408..10fde99f9 100644 --- a/files/classes/submission.py +++ b/files/classes/submission.py @@ -319,7 +319,7 @@ class Submission(Base): else: return "" def realbody(self, v): - if self.club and not (v and v.paid_dues): return f"

{cc} ONLY

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

{cc} ONLY

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

{cc} ONLY

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

{cc} ONLY

" body = self.body body = censor_slurs(body, v) @@ -357,7 +357,7 @@ class Submission(Base): @lazy def realtitle(self, v): - if self.club and not (v and v.paid_dues) and not (v and v.admin_level > 1): + if self.club and not (v and (v.paid_dues or v.id == self.author_id)): if v: return random.choice(TROLLTITLES).format(username=v.username) else: return f'{cc} MEMBERS ONLY' elif self.title_html: title = self.title_html @@ -369,7 +369,7 @@ class Submission(Base): @lazy def plaintitle(self, v): - if self.club and not (v and v.paid_dues) and not (v and v.admin_level > 1): + if self.club and not (v and (v.paid_dues or v.id == self.author_id)): if v: return random.choice(TROLLTITLES).format(username=v.username) else: return f'{cc} MEMBERS ONLY' else: title = self.title diff --git a/files/routes/comments.py b/files/routes/comments.py index 61deea83b..292c84ebf 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -45,7 +45,7 @@ def post_pid_comment_cid(cid, pid=None, anything=None, v=None): g.db.add(notif) g.db.commit() - if comment.post and comment.post.club and not (v and v.paid_dues): abort(403) + if comment.post and comment.post.club and not (v and (v.paid_dues or v.id in [post.author_id, comment.post.author_id])): abort(403) if not comment.parent_submission and not (v and (comment.author.id == v.id or comment.sentto == v.id)) and not (v and v.admin_level > 1) : abort(403) @@ -142,7 +142,7 @@ def api_comment(v): parent_fullname = request.values.get("parent_fullname").strip() parent_post = get_post(parent_submission, v=v) - if parent_post.club and not (v and v.paid_dues): abort(403) + if parent_post.club and not (v and (v.paid_dues or v.id == parent_post.author_id)): abort(403) if parent_fullname.startswith("t2_"): parent = parent_post diff --git a/files/routes/posts.py b/files/routes/posts.py index e175e0f05..807d3cb95 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -125,7 +125,7 @@ def post_id(pid, anything=None, v=None): post = get_post(pid, v=v) - if post.club and not (v and v.paid_dues) or post.private and not (v and (v.id == post.author_id or v.admin_level > 1)): abort(403) + if post.club and not (v and (v.paid_dues or v.id == post.author_id)) or post.private: abort(403) if v: diff --git a/files/templates/submission_listing.html b/files/templates/submission_listing.html index 68f807ca6..d1cfb0d4f 100644 --- a/files/templates/submission_listing.html +++ b/files/templates/submission_listing.html @@ -143,7 +143,7 @@
- {% if p.club and not (v and v.paid_dues) %} + {% if p.club and not (v and (v.paid_dues or v.id == p.author_id)) %} {% elif not p.url %} @@ -467,7 +467,7 @@
-{% if not p.club or v and v.paid_dues %} +{% if not p.club or v and (v.paid_dues or v.id == p.author_id) %} {% if p.realbody(v) %}
{{p.realbody(v) | safe}}