diff --git a/files/routes/settings.py b/files/routes/settings.py
index 66c4998c8..ffcfb8ea4 100644
--- a/files/routes/settings.py
+++ b/files/routes/settings.py
@@ -51,14 +51,14 @@ def settings_personal_post(v):
return True
return False
- def update_flag_with_permanence(column_name:str, request_name:str, friendly_name:str, badge_id:Optional[int]):
+ def update_potentially_permanent_flag(column_name:str, request_name:str, friendly_name:str, badge_id:Optional[int]):
if not request.values.get(request_name): return False
current_value = getattr(v, column_name)
if FEATURES['USERS_PERMANENT_WORD_FILTERS'] and current_value > 1:
abort(403, f"Cannot change the {friendly_name} setting after you've already set it permanently!")
request_flag = int(request.values.get(request_name, '') == 'true')
if current_value and request_flag and request.values.get("permanent", '') == 'true' and request.values.get("username") == v.username:
- if v.client: abort(403, "Cannot set filters permanently from the API")
+ if v.client: abort(403, f"Cannot set {friendly_name} permanently from the API")
request_flag = int(time.time())
setattr(v, column_name, request_flag)
if badge_id: badge_grant(v, badge_id)
@@ -80,14 +80,14 @@ def settings_personal_post(v):
updated = True
session['poor'] = v.poor
- slur_filter_updated = updated or update_flag_with_permanence("slurreplacer", "slurreplacer", "slur replacer", 192)
+ slur_filter_updated = updated or update_potentially_permanent_flag("slurreplacer", "slurreplacer", "slur replacer", 192)
if isinstance(slur_filter_updated, bool):
updated = slur_filter_updated
else:
g.db.add(v)
return slur_filter_updated
- profanity_filter_updated = updated or update_flag_with_permanence("profanityreplacer", "profanityreplacer", "profanity replacer", 190)
+ profanity_filter_updated = updated or update_potentially_permanent_flag("profanityreplacer", "profanityreplacer", "profanity replacer", 190)
if isinstance(profanity_filter_updated, bool):
updated = profanity_filter_updated
else:
diff --git a/files/templates/settings_personal.html b/files/templates/settings_personal.html
index 3a82c0569..db54ed430 100644
--- a/files/templates/settings_personal.html
+++ b/files/templates/settings_personal.html
@@ -220,14 +220,14 @@
{% set ns = namespace(slurtext='Enable if you would like to automatically replace slurs.', profanitytext='Enable if you would like to automatically replace slurs.') %}
{% if FEATURES['USERS_PERMANENT_WORD_FILTERS'] and v.slurreplacer %}
{% if v.slurreplacer == 1 %}
- {% set ns.slurtext = 'Enable if you would like to automatically replace slurs. Make filter permanent for a badge!' %}
+ {% set ns.slurtext = 'Enable if you would like to automatically replace slurs. Make filter permanent for a badge!' %}
{% else %}
{% set ns.slurttext = "You've enabled the slur replacer permanently! ✊🏿" %}
{% endif %}
{% endif %}
{% if FEATURES['USERS_PERMANENT_WORD_FILTERS'] and v.profanityreplacer %}
{% if v.profanityreplacer == 1 %}
- {% set ns.profanitytext = 'Enable if you would like to automatically replace profanities. Make filter permanent for a badge!' %}
+ {% set ns.profanitytext = 'Enable if you would like to automatically replace profanities. Make filter permanent for a badge!' %}
{% else %}
{% set ns.profanitytext = "You've enabled the profanity replacer permanently! 😇" %}
{% endif %}
@@ -306,4 +306,20 @@
{% if v.profanityreplacer == 1 -%}
{{permanent_filter_modal('profanityreplacer', '/settings/personal', 'profanityreplacer', 'Profanity Replacer', 'Soapy-Mouthed Angel')}}
{%- endif %}
+{% if FEATURES['PERMANENT_WORD_FILTERS'] -%}
+
+{% endif %}
{% endblock %}