From e6274e06f32de09492cda2504c410bd608fcd44e Mon Sep 17 00:00:00 2001 From: Aevann Date: Thu, 22 Dec 2022 22:52:36 +0200 Subject: [PATCH] delete ability of jannies to clear internal cache --- files/helpers/config/const.py | 1 - files/helpers/config/modaction_types.py | 5 ----- files/routes/admin.py | 13 ------------- files/templates/admin/admin_home.html | 5 +---- migrations/20221222-remove-janny-internal-cache.sql | 1 + 5 files changed, 2 insertions(+), 23 deletions(-) create mode 100644 migrations/20221222-remove-janny-internal-cache.sql diff --git a/files/helpers/config/const.py b/files/helpers/config/const.py index eb996f6a6..a0590fc94 100644 --- a/files/helpers/config/const.py +++ b/files/helpers/config/const.py @@ -287,7 +287,6 @@ PERMS = { # Minimum admin_level to perform action. 'SITE_SETTINGS_SNAPPY_QUOTES': 3, 'SITE_SETTINGS_UNDER_ATTACK': 3, 'SITE_CACHE_PURGE_CDN': 3, - 'SITE_CACHE_DUMP_INTERNAL': 2, 'SITE_WARN_ON_INVALID_AUTH': 1, 'NOTIFICATIONS_ADMIN_PING': 2, 'NOTIFICATIONS_HOLE_INACTIVITY_DELETION': 2, diff --git a/files/helpers/config/modaction_types.py b/files/helpers/config/modaction_types.py index 3c686e274..a0a9d823e 100644 --- a/files/helpers/config/modaction_types.py +++ b/files/helpers/config/modaction_types.py @@ -96,11 +96,6 @@ MODACTION_TYPES = { "icon": 'fa-dollar-sign', "color": 'bg-success' }, - 'clear_internal_cache': { - "str": 'cleared internal cache', - "icon": 'fa-trash-alt', - "color": 'bg-muted' - }, 'edit_post': { "str": 'edited {self.target_link}', "icon": 'fa-edit', diff --git a/files/routes/admin.py b/files/routes/admin.py index 7a9fe12f2..9e085f88a 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -410,19 +410,6 @@ def clear_cloudflare_cache(v): g.db.add(ma) return {"message": "Cloudflare cache cleared!"} -@app.post("/admin/clear_internal_cache") -@admin_level_required(PERMS['SITE_CACHE_DUMP_INTERNAL']) -def admin_clear_internal_cache(v): - online = cache.get(CHAT_ONLINE_CACHE_KEY) - cache.clear() - cache.set(CHAT_ONLINE_CACHE_KEY, online) - ma = ModAction( - kind="clear_internal_cache", - user_id=v.id - ) - g.db.add(ma) - return {"message": "Internal cache cleared!"} - @app.post("/admin/under_attack") @admin_level_required(PERMS['SITE_SETTINGS_UNDER_ATTACK']) def under_attack(v): diff --git a/files/templates/admin/admin_home.html b/files/templates/admin/admin_home.html index 6eee66f4d..5379e9fb2 100644 --- a/files/templates/admin/admin_home.html +++ b/files/templates/admin/admin_home.html @@ -124,14 +124,11 @@
{% endif %} -{% if v.admin_level >= PERMS['SITE_CACHE_PURGE_CDN'] or v.admin_level >= PERMS['SITE_CACHE_DUMP_INTERNAL'] %} +{% if v.admin_level >= PERMS['SITE_CACHE_PURGE_CDN'] %}

Caching

{% if v.admin_level >= PERMS['SITE_CACHE_PURGE_CDN'] %} {% endif %} - {% if v.admin_level >= PERMS['SITE_CACHE_DUMP_INTERNAL'] %} - - {% endif %} {% endif %}

Server Status

diff --git a/migrations/20221222-remove-janny-internal-cache.sql b/migrations/20221222-remove-janny-internal-cache.sql new file mode 100644 index 000000000..d9e3004b2 --- /dev/null +++ b/migrations/20221222-remove-janny-internal-cache.sql @@ -0,0 +1 @@ +delete from modactions where kind='clear_internal_cache';