From bbc7a4772f2502a0b37b5852bed05b659475ef75 Mon Sep 17 00:00:00 2001 From: Aevann Date: Sat, 7 Oct 2023 21:04:12 +0300 Subject: [PATCH] stop using "flair" instead of "hole" in wpd --- files/helpers/config/const.py | 4 ---- files/routes/jinja2.py | 2 +- files/routes/posts.py | 2 +- files/routes/reporting.py | 2 +- files/routes/search.py | 12 +++++------- files/templates/admin/admin_home.html | 4 ++-- files/templates/header.html | 4 ++-- files/templates/hole/create_hole.html | 8 ++++---- files/templates/hole/holes.html | 4 ++-- files/templates/home.html | 2 +- files/templates/search.html | 4 ++-- files/templates/sidebar_rDrama.html | 4 ++-- files/templates/submit.html | 2 +- files/templates/util/macros.html | 6 +----- 14 files changed, 25 insertions(+), 35 deletions(-) diff --git a/files/helpers/config/const.py b/files/helpers/config/const.py index 9ecff3571..b1e36606f 100644 --- a/files/helpers/config/const.py +++ b/files/helpers/config/const.py @@ -503,8 +503,6 @@ NOTIFICATION_SPAM_AGE_THRESHOLD = 0 COMMENT_SPAM_LENGTH_THRESHOLD = 0 UNDER_SIEGE_AGE_THRESHOLD = 10 * 60 -HOLE_NAME = 'hole' -HOLE_STYLE_FLAIR = False HOLE_REQUIRED = False HOLE_COST = 0 GROUP_COST = 10000 @@ -750,8 +748,6 @@ elif SITE == 'watchpeopledie.tv': MAX_VIDEO_SIZE_MB = 500 MAX_VIDEO_SIZE_MB_PATRON = 500 - HOLE_NAME = 'flair' - HOLE_STYLE_FLAIR = True HOLE_REQUIRED = True AUTOJANNY_ID = 1 diff --git a/files/routes/jinja2.py b/files/routes/jinja2.py index b7af4e692..a7ace365d 100644 --- a/files/routes/jinja2.py +++ b/files/routes/jinja2.py @@ -126,7 +126,7 @@ def inject_constants(): "listdir":listdir, "os_path":path, "PIZZASHILL_ID":PIZZASHILL_ID, "DEFAULT_COLOR":DEFAULT_COLOR, "COLORS":COLORS, "time":time, "PERMS":PERMS, "FEATURES":FEATURES, - "HOLE_NAME":HOLE_NAME, "HOLE_STYLE_FLAIR":HOLE_STYLE_FLAIR, "HOLE_REQUIRED":HOLE_REQUIRED, + "HOLE_REQUIRED":HOLE_REQUIRED, "DEFAULT_THEME":DEFAULT_THEME, "DESCRIPTION":DESCRIPTION, "has_sidebar":has_sidebar, "has_logo":has_logo, "FP":FP, "patron":patron, "get_setting": get_setting, diff --git a/files/routes/posts.py b/files/routes/posts.py index d307521ee..4f48d6612 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -475,7 +475,7 @@ def submit_post(v, hole=None): else: hole = None if not hole and HOLE_REQUIRED: - abort(400, f"You must choose a {HOLE_NAME} for your post!") + abort(400, f"You must choose a hole for your post!") if v.longpost and (len(body) < 280 or ' [](' in body or body.startswith('[](')): abort(400, "You have to type more than 280 characters!") diff --git a/files/routes/reporting.py b/files/routes/reporting.py index 3fad225bb..8fd0bafaf 100644 --- a/files/routes/reporting.py +++ b/files/routes/reporting.py @@ -175,7 +175,7 @@ def move_post(post, v, reason): if hole_from == hole_to: abort(409, f"Post is already in {hole_to_in_notif}") if post.author.exiler_username(hole_to): - abort(403, f"User is exiled from this {HOLE_NAME}!") + abort(403, f"User is exiled from this hole!") if hole_to == 'changelog': abort(403, "/h/changelog is archived!") diff --git a/files/routes/search.py b/files/routes/search.py index 37d7d6201..cf9ba655c 100644 --- a/files/routes/search.py +++ b/files/routes/search.py @@ -10,8 +10,6 @@ from files.helpers.get import * from files.routes.wrappers import * from files.__main__ import app -search_operator_hole = HOLE_NAME - valid_params = [ 'author', 'domain', @@ -22,7 +20,7 @@ valid_params = [ 'exact', 'title', 'sentto', - search_operator_hole, + 'hole', 'subreddit', ] @@ -139,8 +137,8 @@ def searchposts(v): posts = posts.filter(Post.url.ilike(f"https://old.reddit.com/r/{subreddit}/%")) - if search_operator_hole in criteria: - posts = posts.filter(Post.hole == criteria[search_operator_hole]) + if 'hole' in criteria: + posts = posts.filter(Post.hole == criteria['hole']) if 'after' in criteria: after = criteria['after'] @@ -238,8 +236,8 @@ def searchcomments(v): if 'nsfw' in criteria: comments = comments.filter(Comment.nsfw == True) - if search_operator_hole in criteria: - comments = comments.filter(Post.hole == criteria[search_operator_hole]) + if 'hole' in criteria: + comments = comments.filter(Post.hole == criteria['hole']) comments = apply_time_filter(t, comments, Comment) diff --git a/files/templates/admin/admin_home.html b/files/templates/admin/admin_home.html index e31f9e26a..a44a4c21c 100644 --- a/files/templates/admin/admin_home.html +++ b/files/templates/admin/admin_home.html @@ -117,8 +117,8 @@ {% if v.admin_level >= PERMS['EDIT_RULES'] %}
  • Edit the Rules
  • {%- endif %} - {% if v.admin_level >= PERMS['HOLE_CREATE'] %} -
  • Create {{HOLE_NAME | capitalize}}
  • + {% if PERMS['HOLE_CREATE'] and v.admin_level >= PERMS['HOLE_CREATE'] %} +
  • Create Hole
  • {% endif %} {% if v.admin_level >= PERMS['APPS_MODERATION'] %}
  • Apps
  • diff --git a/files/templates/header.html b/files/templates/header.html index f68d44183..b5a27b265 100644 --- a/files/templates/header.html +++ b/files/templates/header.html @@ -1,6 +1,6 @@ {%- set search_placeholder = "Search" -%} {%- if hole -%} - {%- set search_placeholder = "Search (try '" ~ HOLE_NAME ~ ":" ~ hole.name ~ "')" -%} + {%- set search_placeholder = "Search (try 'hole:" ~ hole.name ~ "')" -%} {%- endif -%}