From 31ee3e9f44bdb44cd48cfdb321b503dfc0cbe931 Mon Sep 17 00:00:00 2001 From: Aevann Date: Mon, 25 Dec 2023 03:18:48 +0200 Subject: [PATCH] OVER_18_EMOJIS -> NSFW_EMOJIS --- files/classes/comment.py | 8 ++++---- files/classes/post.py | 4 ++-- files/helpers/const_stateful.py | 6 +++--- files/helpers/sanitize.py | 4 ++-- files/routes/asset_submissions.py | 2 +- files/routes/jinja2.py | 4 ++-- files/templates/awards.html | 2 +- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/files/classes/comment.py b/files/classes/comment.py index 070ec0151..4be0780b0 100644 --- a/files/classes/comment.py +++ b/files/classes/comment.py @@ -20,11 +20,11 @@ from files.helpers.sorting_and_time import * from .saves import CommentSaveRelationship -def get_emoji_awards_emojis(obj, v, kind, OVER_18_EMOJIS): +def get_emoji_awards_emojis(obj, v, kind, NSFW_EMOJIS): if g.show_nsfw: emojis = [x.note for x in obj.awards if x.kind == kind] else: - emojis = [x.note for x in obj.awards if x.kind == kind and x.note not in OVER_18_EMOJIS] + emojis = [x.note for x in obj.awards if x.kind == kind and x.note not in NSFW_EMOJIS] return reversed(emojis[:20]) def get_award_classes(obj, v, title=False): @@ -512,8 +512,8 @@ class Comment(Base): return get_award_classes(self, v) @lazy - def emoji_awards_emojis(self, v, kind, OVER_18_EMOJIS): - return get_emoji_awards_emojis(self, v, kind, OVER_18_EMOJIS) + def emoji_awards_emojis(self, v, kind, NSFW_EMOJIS): + return get_emoji_awards_emojis(self, v, kind, NSFW_EMOJIS) @property @lazy diff --git a/files/classes/post.py b/files/classes/post.py index acd1a72b0..9d4a95d94 100644 --- a/files/classes/post.py +++ b/files/classes/post.py @@ -390,8 +390,8 @@ class Post(Base): return get_award_classes(self, v, title) @lazy - def emoji_awards_emojis(self, v, kind, OVER_18_EMOJIS): - return get_emoji_awards_emojis(self, v, kind, OVER_18_EMOJIS) + def emoji_awards_emojis(self, v, kind, NSFW_EMOJIS): + return get_emoji_awards_emojis(self, v, kind, NSFW_EMOJIS) @property @lazy diff --git a/files/helpers/const_stateful.py b/files/helpers/const_stateful.py index 2b53e391b..94aa5c920 100644 --- a/files/helpers/const_stateful.py +++ b/files/helpers/const_stateful.py @@ -12,10 +12,10 @@ SNAPPY_QUOTES = [] SNAPPY_QUOTES_FISTMAS = [] SNAPPY_QUOTES_HOMOWEEN = [] STEALTH_HOLES = [] -OVER_18_EMOJIS = [] +NSFW_EMOJIS = [] def const_initialize(): - global MARSEYS_CONST, MARSEYS_CONST2, MARSEY_MAPPINGS, SNAPPY_KONGS, SNAPPY_MARSEYS, SNAPPY_QUOTES, SNAPPY_QUOTES_FISTMAS, SNAPPY_QUOTES_HOMOWEEN, STEALTH_HOLES, OVER_18_EMOJIS + global MARSEYS_CONST, MARSEYS_CONST2, MARSEY_MAPPINGS, SNAPPY_KONGS, SNAPPY_MARSEYS, SNAPPY_QUOTES, SNAPPY_QUOTES_FISTMAS, SNAPPY_QUOTES_HOMOWEEN, STEALTH_HOLES, NSFW_EMOJIS db = db_session() @@ -35,7 +35,7 @@ def const_initialize(): STEALTH_HOLES = [x[0] for x in db.query(Hole.name).filter_by(stealth=True)] - OVER_18_EMOJIS = [x[0] for x in db.query(Emoji.name).filter_by(nsfw=True)] + NSFW_EMOJIS = [x[0] for x in db.query(Emoji.name).filter_by(nsfw=True)] db.commit() db.close() diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py index 4bc7d498b..39dfee72b 100644 --- a/files/helpers/sanitize.py +++ b/files/helpers/sanitize.py @@ -531,7 +531,7 @@ def sanitize(sanitized, golden=True, limit_pings=0, showmore=False, count_emojis if FEATURES['NSFW_MARKING'] and obj: for emoji in emojis_used: - if emoji in OVER_18_EMOJIS: + if emoji in NSFW_EMOJIS: obj.nsfw = True break @@ -702,7 +702,7 @@ def filter_emojis_only(title, golden=True, count_emojis=False, obj=None, author= if FEATURES['NSFW_MARKING'] and obj: for emoji in emojis_used: - if emoji in OVER_18_EMOJIS: + if emoji in NSFW_EMOJIS: obj.nsfw = True break diff --git a/files/routes/asset_submissions.py b/files/routes/asset_submissions.py index 41f4c7b33..5c459f4fa 100644 --- a/files/routes/asset_submissions.py +++ b/files/routes/asset_submissions.py @@ -238,7 +238,7 @@ def approve_emoji(v, name): g.db.add(ma) if emoji.nsfw: - OVER_18_EMOJIS.append(emoji.name) + NSFW_EMOJIS.append(emoji.name) g.db.commit() diff --git a/files/routes/jinja2.py b/files/routes/jinja2.py index a5925d59f..2a67d6947 100644 --- a/files/routes/jinja2.py +++ b/files/routes/jinja2.py @@ -14,7 +14,7 @@ from files.classes.orgy import get_running_orgy from files.classes.emoji import Emoji from files.helpers.assetcache import assetcache_path from files.helpers.config.const import * -from files.helpers.const_stateful import OVER_18_EMOJIS +from files.helpers.const_stateful import NSFW_EMOJIS from files.helpers.regex import * from files.helpers.settings import * from files.helpers.cloudflare import * @@ -154,7 +154,7 @@ def inject_constants(): "SITE_FULL_IMAGES": SITE_FULL_IMAGES, "IS_EVENT":IS_EVENT, "IS_FISTMAS":IS_FISTMAS, "IS_HOMOWEEN":IS_HOMOWEEN, "IS_DKD":IS_DKD, "IS_BIRTHGAY":IS_BIRTHGAY, "IS_BIRTHDEAD":IS_BIRTHDEAD, - "CHUD_PHRASES":CHUD_PHRASES, "hasattr":hasattr, "calc_users":calc_users, "HOLE_INACTIVITY_DELETION":HOLE_INACTIVITY_DELETION, "LIGHT_THEMES":LIGHT_THEMES, "OVER_18_EMOJIS":OVER_18_EMOJIS, + "CHUD_PHRASES":CHUD_PHRASES, "hasattr":hasattr, "calc_users":calc_users, "HOLE_INACTIVITY_DELETION":HOLE_INACTIVITY_DELETION, "LIGHT_THEMES":LIGHT_THEMES, "NSFW_EMOJIS":NSFW_EMOJIS, "MAX_IMAGE_AUDIO_SIZE_MB":MAX_IMAGE_AUDIO_SIZE_MB, "MAX_IMAGE_AUDIO_SIZE_MB_PATRON":MAX_IMAGE_AUDIO_SIZE_MB_PATRON, "MAX_VIDEO_SIZE_MB":MAX_VIDEO_SIZE_MB, "MAX_VIDEO_SIZE_MB_PATRON":MAX_VIDEO_SIZE_MB_PATRON, "CURSORMARSEY_DEFAULT":CURSORMARSEY_DEFAULT, "SNAPPY_ID":SNAPPY_ID, "get_running_orgy":get_running_orgy, "TRUESCORE_MINIMUM":TRUESCORE_MINIMUM, "bar_position":bar_position, "datetime":datetime, "CSS_LENGTH_LIMIT":CSS_LENGTH_LIMIT, "cache":cache, "emoji_count":emoji_count, "HOLE_SIDEBAR_COLUMN_LENGTH":HOLE_SIDEBAR_COLUMN_LENGTH, diff --git a/files/templates/awards.html b/files/templates/awards.html index bef6b1fc4..6b8ac1b2e 100644 --- a/files/templates/awards.html +++ b/files/templates/awards.html @@ -12,7 +12,7 @@ {% if p.award_count("emoji", v) or p.award_count("emoji-hz", v) %} {% for kind in ["emoji", "emoji-hz"] %}
- {% for emoji in p.emoji_awards_emojis(v, kind, OVER_18_EMOJIS) %} + {% for emoji in p.emoji_awards_emojis(v, kind, NSFW_EMOJIS) %} {% set src = '/e/' + emoji + '.webp' %} {% set alt = 'emoji-award-' + emoji %} {% set delay = 'animation-delay-' ~ ((loop.index-1)/4)|int %}