From fde8ceb7513515309c92a024d9c9695639e452c8 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Tue, 16 Nov 2021 00:19:59 +0200 Subject: [PATCH] sfdfsd --- files/classes/user.py | 4 ++-- files/routes/comments.py | 4 ++-- files/routes/front.py | 2 +- files/routes/posts.py | 6 ++--- files/routes/search.py | 6 ++--- files/templates/comments.html | 22 +++++++++--------- files/templates/header.html | 2 +- files/templates/notifications.html | 2 +- files/templates/settings2.html | 2 +- files/templates/submission.html | 30 ++++++++++++------------- files/templates/submission_banned.html | 8 +++---- files/templates/submission_listing.html | 24 ++++++++++---------- files/templates/userpage.html | 2 +- 13 files changed, 57 insertions(+), 57 deletions(-) diff --git a/files/classes/user.py b/files/classes/user.py index c69e55899..5803d87af 100644 --- a/files/classes/user.py +++ b/files/classes/user.py @@ -211,12 +211,12 @@ class User(Base): @cache.memoize(timeout=86400) def userpagelisting(self, v=None, page=1, sort="new", t="all"): - if self.shadowbanned and not (v and (v.admin_level >= 3 or v.id == self.id)): + if self.shadowbanned and not (v and (v.admin_level > 1 or v.id == self.id)): return [] posts = g.db.query(Submission.id).filter_by(author_id=self.id, is_pinned=False) - if not (v and (v.admin_level >= 3 or v.id == self.id)): + if not (v and (v.admin_level > 1 or v.id == self.id)): posts = posts.filter_by(deleted_utc=0, is_banned=False, private=False) now = int(time.time()) diff --git a/files/routes/comments.py b/files/routes/comments.py index f01899c8e..fc171b14d 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -122,7 +122,7 @@ def post_pid_comment_cid(cid, pid=None, anything=None, v=None): if request.headers.get("Authorization"): return top_comment.json else: - if post.is_banned and not (v and (v.admin_level >= 3 or post.author_id == v.id)): template = "submission_banned.html" + if post.is_banned and not (v and (v.admin_level > 1 or post.author_id == v.id)): template = "submission_banned.html" else: template = "submission.html" return render_template(template, v=v, p=post, sort=sort, linked_comment=comment, comment_info=comment_info, render_replies=True) @@ -203,7 +203,7 @@ def api_comment(v): ).first() if existing: return {"error": f"You already made that comment: /comment/{existing.id}"}, 409 - if parent.author.any_block_exists(v) and not v.admin_level>=3: return {"error": "You can't reply to users who have blocked you, or users you have blocked."}, 403 + if parent.author.any_block_exists(v) and v.admin_level < 2: return {"error": "You can't reply to users who have blocked you, or users you have blocked."}, 403 is_bot = request.headers.get("Authorization") diff --git a/files/routes/front.py b/files/routes/front.py index a4ccb8eae..3650d9de7 100644 --- a/files/routes/front.py +++ b/files/routes/front.py @@ -369,7 +369,7 @@ def comment_idlist(page=1, v=None, nsfw=False, sort="new", t="all"): Comment.author_id.notin_(blocked) ) - if not v or not v.admin_level >= 3: + if not v or not v.admin_level > 1: comments = comments.filter_by(is_banned=False).filter(Comment.deleted_utc == 0) now = int(time.time()) diff --git a/files/routes/posts.py b/files/routes/posts.py index bf9bfc29d..dcada4752 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -201,7 +201,7 @@ def post_id(pid, anything=None, v=None): g.db.commit() if request.headers.get("Authorization"): return post.json else: - if post.is_banned and not (v and (v.admin_level >= 3 or post.author_id == v.id)): template = "submission_banned.html" + if post.is_banned and not (v and (v.admin_level > 1 or post.author_id == v.id)): template = "submission_banned.html" else: template = "submission.html" return render_template(template, v=v, p=post, sort=sort, render_replies=True) @@ -991,7 +991,7 @@ def undelete_post_pid(pid, v): def toggle_comment_nsfw(cid, v): comment = g.db.query(Comment).filter_by(id=cid).first() - if not comment.author_id == v.id and not v.admin_level >= 3: abort(403) + if not comment.author_id == v.id and not v.admin_level > 1: abort(403) comment.over_18 = not comment.over_18 g.db.add(comment) g.db.flush() @@ -1008,7 +1008,7 @@ def toggle_post_nsfw(pid, v): post = get_post(pid) - if not post.author_id == v.id and not v.admin_level >= 3: + if not post.author_id == v.id and not v.admin_level > 1: abort(403) post.over_18 = not post.over_18 diff --git a/files/routes/search.py b/files/routes/search.py index 7fdcaa771..de4ffa182 100644 --- a/files/routes/search.py +++ b/files/routes/search.py @@ -90,13 +90,13 @@ def searchposts(v): ) ) - if not(v and v.admin_level >= 3): + if not(v and v.admin_level > 1): posts = posts.filter( Submission.deleted_utc == 0, Submission.is_banned == False, ) - if v and v.admin_level >= 4: + if v and v.admin_level > 1: pass elif v: blocking = [x[0] for x in g.db.query( @@ -207,7 +207,7 @@ def searchcomments(v): if 'author' in criteria: comments = comments.filter(Comment.author_id == get_user(criteria['author']).id) - if not(v and v.admin_level >= 3): + if not(v and v.admin_level > 1): comments = comments.filter( Comment.deleted_utc == 0, Comment.is_banned == False) diff --git a/files/templates/comments.html b/files/templates/comments.html index b9401a897..c3eabf544 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -291,7 +291,7 @@ {% endif %} {% if c.active_flags %}{{c.active_flags}} Reports{% endif %} {% if c.over_18 %}+18{% endif %} - {% if v and v.admin_level> 1 and c.author.shadowbanned %}{% endif %} + {% if v and v.admin_level > 1 and c.author.shadowbanned %}{% endif %} {% if c.is_pinned %}{% endif %} {% if c.distinguish_level %}{% endif %} {% if c.is_op %}{% endif %} @@ -319,7 +319,7 @@

 				
 			
@@ -461,7 +461,7 @@
 							{% endif %}
 
 						{% endif %}
-						{% if v and v.admin_level> 1 and v.id==c.author_id %}
+						{% if v and v.admin_level > 1 and v.id==c.author_id %}
 							Undistinguish
 							Distinguish
 						{% endif %}
@@ -474,14 +474,14 @@
 							Block user
 						{% endif %}
 
-						{% if v and c.post and (v.admin_level >= 1 or v.id == c.post.author_id) and c.level == 1 %}
+						{% if v and c.post and (v.admin_level > 1 or v.id == c.post.author_id) and c.level == 1 %}
 							Unpin
 
 							Pin
 						{% endif %}
 
 
-						{% if v and v.admin_level>=3 %}
+						{% if v and v.admin_level > 1 %}
 							{% if "/reported/" in request.path %}
 								Approve
 								Remove
@@ -496,12 +496,12 @@
 							Mark +18
 						{% endif %}
 
-						{% if v and v.admin_level> 1 and v.id != c.author_id %}
+						{% if v and v.admin_level > 1 and v.id != c.author_id %}
 							Unban user
 							Ban user
 						{% endif %}
 
-						{% if v and v.admin_level >=4 and c.oauth_app %}
+						{% if v and v.admin_level > 1 and c.oauth_app %}
 							API App
 						{% endif %}
 
@@ -624,17 +624,17 @@
 						{% endif %}
 					{% endif %}
 
-					{% if v and c.post and (v.admin_level >= 1 or v.id == c.post.author_id) and c.level == 1 %}
+					{% if v and c.post and (v.admin_level > 1 or v.id == c.post.author_id) and c.level == 1 %}
 						Pin
 						Unpin
 					{% endif %}
 
 					{% if v %}
-						{% if v.admin_level>=1 and v.id==c.author_id %}
+						{% if v.admin_level > 1 and v.id==c.author_id %}
 							Distinguish
 							Undistinguish
 						{% endif %}
-						{% if v.admin_level>=3 %}
+						{% if v.admin_level > 1 %}
 							{% if "/reported/" in request.path %}
 								Remove
 								Approve
@@ -643,7 +643,7 @@
 								Approve
 							{% endif %}
 						{% endif %}
-						{% if v.admin_level >=4 and c.oauth_app %}
+						{% if v.admin_level > 1 and c.oauth_app %}
 							API App
 						{% endif %}
 
diff --git a/files/templates/header.html b/files/templates/header.html
index 30f8db4f7..7f97b6103 100644
--- a/files/templates/header.html
+++ b/files/templates/header.html
@@ -63,7 +63,7 @@
 					
 				
 
-				{% if v and v.admin_level> 1 %}
+				{% if v and v.admin_level > 1 %}
 				
diff --git a/files/templates/notifications.html b/files/templates/notifications.html
index fb87f91b7..e8581a7ef 100644
--- a/files/templates/notifications.html
+++ b/files/templates/notifications.html
@@ -30,7 +30,7 @@
 		Messages
 		
 	
-	{% if v.admin_level> 1 %}
+	{% if v.admin_level > 1 %}
 		
 
-						{% if v and (v.id==p.author_id or v.admin_level> 1 and v.admin_level > 2) %}
+						{% if v and (v.id==p.author_id or v.admin_level > 1 and v.admin_level > 2) %}
 							Edit
 						{% endif %}
 
@@ -639,7 +639,7 @@
 								Delete
 							{% endif %}
 						{% endif %}
-						{% if v and v.admin_level>=3 %}
+						{% if v and v.admin_level > 1 %}
 							Pin
 							Unpin
 							{% if v==p.author %}
@@ -649,12 +649,12 @@
 						{% endif %}
 
 						{% if v %}
-							{% if v.admin_level >=3 or v.id == p.author.id and v.paid_dues %}
+							{% if v.admin_level > 1 or v.id == p.author.id and v.paid_dues %}
 								Mark club
 								Unmark club
 							{% endif %}
 
-							{% if v.admin_level >=3 %}
+							{% if v.admin_level > 1 %}
 								{% if "/reported/" in request.path %}
 									{% if v.id != p.author.id %}Remove{% endif %}
 									Approve
@@ -664,12 +664,12 @@
 								{% endif %}
 							{% endif %}
 
-							{% if v.id == p.author_id or v.admin_level >= 3 %}
+							{% if v.id == p.author_id or v.admin_level > 1 %}
 								Mark +18
 								Unmark +18
 							{% endif %}
 
-							{% if v.admin_level >= 4 and p.oauth_app %}
+							{% if v.admin_level > 1 and p.oauth_app %}
 								API App
 							{% endif %}
 
@@ -686,7 +686,7 @@
 								Unban user
 							{% endif %}
 
-							{% if v.admin_level >=3 and v.id!=p.author_id %}
+							{% if v.admin_level > 1 and v.id!=p.author_id %}
 								Ban user
 								Unban user
 							{% endif %}
diff --git a/files/templates/submission_banned.html b/files/templates/submission_banned.html
index 3d7145f40..7f591e9e4 100644
--- a/files/templates/submission_banned.html
+++ b/files/templates/submission_banned.html
@@ -19,19 +19,19 @@
 {% endblock %}
 
 {% block adminpanel %}
-{% if v.admin_level >=3 %}
+{% if v.admin_level > 1 %}
 
 
 
 
 {% endif %}
-{% if v.admin_level >=3 and v.id==p.author_id %}
+{% if v.admin_level > 1 and v.id==p.author_id %}
 
{% endif %} -{% if v.admin_level >=1 and v.admin_level > p.author.admin_level %} +{% if v.admin_level > 1 and v.admin_level > p.author.admin_level %} {% if p.is_banned %}
@@ -72,7 +72,7 @@ - {% if v and v.admin_level >=3 and p.body_html %} + {% if v and v.admin_level > 1 and p.body_html %}
{{p.body_html | safe}}
diff --git a/files/templates/submission_listing.html b/files/templates/submission_listing.html index 9cacb40fb..b35951ac4 100644 --- a/files/templates/submission_listing.html +++ b/files/templates/submission_listing.html @@ -119,7 +119,7 @@

 		
 	
@@ -204,7 +204,7 @@
 						
 					{% endfor %}
 				{% endif %}
-				{% if v and v.admin_level> 1 and p.author.shadowbanned %}{% endif %}
+				{% if v and v.admin_level > 1 and p.author.shadowbanned %}{% endif %}
 				{% if p.stickied %}{% endif %}
 				{% if p.distinguish_level %}{% endif %}
 				{% if p.is_pinned and request.path.startswith('/@') %}{% endif %}
@@ -271,7 +271,7 @@
 								{% endif %}
 							{% endif %}
 
-						{% if v and v.admin_level>=3 %}
+						{% if v and v.admin_level > 1 %}
 							Pin
 							Unpin
 							{% if v==p.author %}
@@ -281,12 +281,12 @@
 						{% endif %}
 
 						{% if v %}
-							{% if v.admin_level >=3 or v.id == p.author.id and v.paid_dues %}
+							{% if v.admin_level > 1 or v.id == p.author.id and v.paid_dues %}
 								Mark club
 								Unmark club
 							{% endif %}
 
-							{% if v.admin_level >=3 %}
+							{% if v.admin_level > 1 %}
 								{% if "/reported/" in request.path %}
 									{% if v.id != p.author.id %}Remove{% endif %}
 									Approve
@@ -297,7 +297,7 @@
 							{% endif %}
 
 
-							{% if v.admin_level >= 4 and p.oauth_app %}
+							{% if v.admin_level > 1 and p.oauth_app %}
 								API App
 							{% endif %}
 
@@ -309,12 +309,12 @@
 								Block user
 							{% endif %}
 
-							{% if v and (v.id==p.author_id or v.admin_level>=3) %}
+							{% if v and (v.id==p.author_id or v.admin_level > 1) %}
 								Mark +18
 								Unmark +18
 							{% endif %}
 
-							{% if v.admin_level >=3 and v.id!=p.author_id %}
+							{% if v.admin_level > 1 and v.id!=p.author_id %}
 								Ban user
 								Unban user
 							{% endif %}
@@ -437,12 +437,12 @@
 						
 						
 
-						{% if v.admin_level >=3 or v.id == p.author.id and v.paid_dues %}
+						{% if v.admin_level > 1 or v.id == p.author.id and v.paid_dues %}
 							
 							
 						{% endif %}
 
-						{% if v.admin_level >=3 %}
+						{% if v.admin_level > 1 %}
 							
 							
 							{% if v==p.author %}
@@ -459,7 +459,7 @@
 							{% endif %}
 						{% endif %}
 
-						{% if v.admin_level >=4 and p.oauth_app %}
+						{% if v.admin_level > 1 and p.oauth_app %}
 							
 						{% endif %}
 
@@ -473,7 +473,7 @@
 						
 					{% endif %}
 
-					{% if v and (v.id==p.author_id or v.admin_level>=3) %}
+					{% if v and (v.id==p.author_id or v.admin_level > 1) %}
 						
 						
 					{% endif %}
diff --git a/files/templates/userpage.html b/files/templates/userpage.html
index ce4b4fd65..fe73c0d96 100644
--- a/files/templates/userpage.html
+++ b/files/templates/userpage.html
@@ -359,7 +359,7 @@
 						{% endif %}
 					

 					

User ID: {{u.id}}

- {% if v and v.admin_level >=4 %} + {% if v and v.admin_level > 1 %} {% if u.is_private %}

User has private mode enabled.

{% endif %}