Revert "convert IS_FISTMAS and IS_HOMOWEEN from functions to variables"

This reverts commit b45d845630.
pull/138/head
Aevann 2023-03-08 08:51:40 +02:00
parent 292498bdc8
commit 9f66e33061
16 changed files with 51 additions and 51 deletions

View File

@ -45,7 +45,7 @@ else:
DEFAULT_COINS = 0
DEFAULT_MARSEYBUX = 0
if IS_FISTMAS:
if IS_FISTMAS():
if SITE_NAME == 'rDrama':
default_event_music = True
default_darkmode = False
@ -161,7 +161,7 @@ class User(Base):
spider = Column(Integer, default=0)
blacklisted_by = Column(Integer, ForeignKey("users.id"))
if IS_FISTMAS:
if IS_FISTMAS():
event_music = Column(Boolean, default=default_event_music, nullable=False)
event_darkmode = Column(Boolean, default=default_darkmode, nullable=False)
@ -300,7 +300,7 @@ class User(Base):
@lazy
def hat_active(self, v):
if FEATURES['HATS']:
if IS_FISTMAS:
if IS_FISTMAS():
hat = random.choice(('Santa Hat III', 'Winter Cap', 'Present Bow'))
if SITE_NAME == 'rDrama':
return (f'/i/hats/{hat}.webp', 'Merry Fistmas!')
@ -1198,7 +1198,7 @@ class User(Base):
return output
if IS_FISTMAS:
if IS_FISTMAS():
@property
@lazy
def can_toggle_event_music(self):

View File

@ -60,7 +60,7 @@ def execute_snappy(post:Submission, v:User):
body = "Can you people come up with any ideas that don't involve committing federal crimes"
else:
if SNAPPY_MARSEYS and SNAPPY_QUOTES:
if IS_FISTMAS or random.random() > 0.5:
if IS_FISTMAS() or random.random() > 0.5:
SNAPPY_CHOICES = SNAPPY_QUOTES
else:
SNAPPY_CHOICES = SNAPPY_MARSEYS

View File

@ -12,7 +12,7 @@ ASSET_SUBDIRS = ['/css', '/js', '/js/vendor']
ASSET_URL = '/assets/'
ASSET_CACHE = defaultdict(lambda: None)
if IS_FISTMAS:
if IS_FISTMAS():
ASSET_SUBDIRS.extend(['/fistmas/css', '/fistmas/css/themes', '/fistmas/js', '/fistmas/js/vendor'])
def assetcache_build(asset_dir, subdirs):

View File

@ -53,7 +53,7 @@ AWARDS = {
"deflectable": True,
"cosmetic": False,
"ghost": False,
"enabled": IS_FISTMAS,
"enabled": IS_FISTMAS(),
},
"snow": {
"kind": "snow",
@ -65,7 +65,7 @@ AWARDS = {
"deflectable": False,
"cosmetic": True,
"ghost": True,
"enabled": IS_FISTMAS,
"enabled": IS_FISTMAS(),
},
"gingerbread": {
"kind": "gingerbread",
@ -77,7 +77,7 @@ AWARDS = {
"deflectable": False,
"cosmetic": True,
"ghost": True,
"enabled": IS_FISTMAS,
"enabled": IS_FISTMAS(),
},
"lights": {
"kind": "lights",
@ -89,7 +89,7 @@ AWARDS = {
"deflectable": False,
"cosmetic": True,
"ghost": True,
"enabled": IS_FISTMAS,
"enabled": IS_FISTMAS(),
},
"candycane": {
"kind": "candycane",
@ -101,7 +101,7 @@ AWARDS = {
"deflectable": False,
"cosmetic": True,
"ghost": True,
"enabled": IS_FISTMAS,
"enabled": IS_FISTMAS(),
},
"fireplace": {
"kind": "fireplace",
@ -113,7 +113,7 @@ AWARDS = {
"deflectable": False,
"cosmetic": True,
"ghost": True,
"enabled": IS_FISTMAS,
"enabled": IS_FISTMAS(),
},
"frostbite": {
"kind": "frostbite",
@ -125,7 +125,7 @@ AWARDS = {
"deflectable": False,
"cosmetic": True,
"ghost": True,
"enabled": IS_FISTMAS,
"enabled": IS_FISTMAS(),
},
"grinch": {
"kind": "grinch",
@ -137,7 +137,7 @@ AWARDS = {
"deflectable": True,
"cosmetic": False,
"ghost": False,
"enabled": IS_FISTMAS,
"enabled": IS_FISTMAS(),
},
### Homoween
@ -151,7 +151,7 @@ AWARDS = {
"deflectable": False,
"cosmetic": True,
"ghost": True,
"enabled": IS_HOMOWEEN,
"enabled": IS_HOMOWEEN(),
},
"upsidedown": {
"kind": "upsidedown",
@ -163,7 +163,7 @@ AWARDS = {
"deflectable": False,
"cosmetic": True,
"ghost": True,
"enabled": IS_HOMOWEEN,
"enabled": IS_HOMOWEEN(),
},
"stab": {
"kind": "stab",
@ -175,7 +175,7 @@ AWARDS = {
"deflectable": False,
"cosmetic": True,
"ghost": True,
"enabled": IS_HOMOWEEN,
"enabled": IS_HOMOWEEN(),
},
"spiders": {
"kind": "spiders",
@ -187,7 +187,7 @@ AWARDS = {
"deflectable": False,
"cosmetic": True,
"ghost": True,
"enabled": IS_HOMOWEEN,
"enabled": IS_HOMOWEEN(),
},
"fog": {
"kind": "fog",
@ -199,7 +199,7 @@ AWARDS = {
"deflectable": False,
"cosmetic": True,
"ghost": True,
"enabled": IS_HOMOWEEN,
"enabled": IS_HOMOWEEN(),
},
"jumpscare": {
"kind": "jumpscare",
@ -211,7 +211,7 @@ AWARDS = {
"deflectable": True,
"cosmetic": False,
"ghost": False,
"enabled": IS_HOMOWEEN,
"enabled": IS_HOMOWEEN(),
},
"hw-bite": {
"kind": "hw-bite",
@ -223,7 +223,7 @@ AWARDS = {
"deflectable": True,
"cosmetic": False,
"ghost": False,
"enabled": IS_HOMOWEEN,
"enabled": IS_HOMOWEEN(),
},
"hw-vax": {
"kind": "hw-vax",
@ -235,7 +235,7 @@ AWARDS = {
"deflectable": True,
"cosmetic": False,
"ghost": False,
"enabled": IS_HOMOWEEN,
"enabled": IS_HOMOWEEN(),
},
"hw-grinch": {
"kind": "hw-grinch",
@ -247,7 +247,7 @@ AWARDS = {
"deflectable": True,
"cosmetic": False,
"ghost": False,
"enabled": IS_HOMOWEEN,
"enabled": IS_HOMOWEEN(),
},
"flashlight": {
"kind": "flashlight",
@ -259,7 +259,7 @@ AWARDS = {
"deflectable": False,
"cosmetic": True,
"ghost": True,
"enabled": IS_HOMOWEEN,
"enabled": IS_HOMOWEEN(),
},
"candy-corn": {
"kind": "candy-corn",
@ -271,7 +271,7 @@ AWARDS = {
"deflectable": False,
"cosmetic": True,
"ghost": True,
"enabled": IS_HOMOWEEN,
"enabled": IS_HOMOWEEN(),
},
"ectoplasm": {
"kind": "ectoplasm",
@ -283,7 +283,7 @@ AWARDS = {
"deflectable": False,
"cosmetic": True,
"ghost": True,
"enabled": IS_HOMOWEEN,
"enabled": IS_HOMOWEEN(),
},
"bones": {
"kind": "bones",
@ -295,7 +295,7 @@ AWARDS = {
"deflectable": False,
"cosmetic": True,
"ghost": True,
"enabled": IS_HOMOWEEN,
"enabled": IS_HOMOWEEN(),
},
"pumpkin": {
"kind": "pumpkin",
@ -307,7 +307,7 @@ AWARDS = {
"deflectable": False,
"cosmetic": True,
"ghost": True,
"enabled": IS_HOMOWEEN,
"enabled": IS_HOMOWEEN(),
},
### Standard

View File

@ -8,13 +8,13 @@ t = datetime.datetime.now()
fistmas_begin = datetime.datetime.strptime(f'1/12/{t.year}', '%d/%m/%Y')
fistmas_end = datetime.datetime.strptime(f'30/12/{t.year}', '%d/%m/%Y')
IS_FISTMAS = fistmas_begin < datetime.datetime.now() < fistmas_end
def IS_FISTMAS():
return fistmas_begin < datetime.datetime.now() < fistmas_end
homoween_begin = datetime.datetime.strptime(f'15/10/{t.year}', '%d/%m/%Y')
homoween_end = datetime.datetime.strptime(f'1/11/{t.year}', '%d/%m/%Y')
IS_HOMOWEEN = homoween_begin < datetime.datetime.now() < homoween_end
def IS_HOMOWEEN():
return homoween_begin < datetime.datetime.now() < homoween_end
DEFAULT_TIME_FILTER = "all"
DEFAULT_THEME = "midnight"

View File

@ -32,7 +32,7 @@ def _initialize_snappy_marseys_and_quotes():
SNAPPY_MARSEYS = [f':#{x}:' for x in marseys_const2]
filename = f"snappy_{SITE_NAME}.txt"
if IS_FISTMAS: filename = f"snappy_event_{SITE_NAME}.txt"
if IS_FISTMAS(): filename = f"snappy_event_{SITE_NAME}.txt"
try:
with open(filename, "r", encoding="utf-8") as f:

View File

@ -201,7 +201,7 @@ def settings_personal_post(v):
badge = v.has_badge(179)
if badge: g.db.delete(badge)
elif IS_FISTMAS and not updated and request.values.get("event_music", v.event_music) != v.event_music and v.can_toggle_event_music:
elif IS_FISTMAS() and not updated and request.values.get("event_music", v.event_music) != v.event_music and v.can_toggle_event_music:
updated = True
v.event_music = not v.event_music
@ -920,7 +920,7 @@ def settings_checkmark_text(v):
g.db.add(v)
return redirect("/settings/personal?msg=Checkmark Text successfully updated!")
if IS_FISTMAS:
if IS_FISTMAS():
@app.post("/events/fistmas2022/darkmode")
@limiter.limit('1/second', scope=rpath)
@limiter.limit(DEFAULT_RATELIMIT)

View File

@ -89,7 +89,7 @@ def vote_post_comment(target_id, new, v, cls, vote_cls):
if SITE_NAME == 'WPD':
coin_mult *= 2
if IS_FISTMAS:
if IS_FISTMAS():
coin_mult *= 2
coin_value = coin_delta * coin_mult

View File

@ -4,7 +4,7 @@
{% block banner %}
{% include "modals/expanded_image.html" %}
{% if err or '@' not in request.path %}
{% if IS_FISTMAS and not sub %}
{% if IS_FISTMAS() and not sub %}
{% include 'fistmas/banner.html' %}
{% else %}
{% if err and SITE_NAME == 'rDrama' %}
@ -79,7 +79,7 @@
<script defer src="{{'js/spider.js' | asset}}"></script>
{% endif %}
{% if IS_FISTMAS %}
{% if IS_FISTMAS() %}
{% include "fistmas/music.html" %}
{% endif %}

View File

@ -10,7 +10,7 @@
{% if range(1,5) | random == 1 %}
{% include "journoid_banner.html" %}
{% else %}
{% if IS_FISTMAS %}
{% if IS_FISTMAS() %}
{%- set VISITORS_HERE_FLAVOR = [
' santa enjoyers kissing under a misletoe',
' bringing up family drama at Christmas dinner',
@ -55,7 +55,7 @@
<div class="navbar navbar-expand-md navbar-light" id="navbar">
<div class="container-fluid" style="padding:0;">
<a href="/" class="navbar-brand mr-auto {% if not has_logo and not sub %}flex-grow-1{% endif %}">
{% if IS_FISTMAS %}
{% if IS_FISTMAS() %}
{% if SITE_NAME == 'WPD' %}
{% set icon_url = 'icons-events/2022-christmas.webp' | asset_siteimg %}
{% else %}
@ -72,7 +72,7 @@
{% elif has_logo %}
<div id="logo-container" class="flex-grow-1 logo-container">
<a href="/">
{% if SITE_NAME == 'WPD' and IS_FISTMAS %}
{% if SITE_NAME == 'WPD' and IS_FISTMAS() %}
<img loading="lazy" class="ml-1" id="logo-{{SITE_NAME}}" alt="logo" src="{{'icons-event/2022-christmas-logo.webp' | asset_siteimg}}" width="70">
{% else %}
<img loading="lazy" class="ml-1" id="logo-{{SITE_NAME}}" alt="logo" src="{{'logo.webp' | asset_siteimg}}" width="70">

View File

@ -9,7 +9,7 @@
{%- import 'util/html_head.html' as html_head with context -%}
<!DOCTYPE html>
<html lang="en" {% if not IS_FISTMAS %}style="--primary:#{{v.themecolor if v else DEFAULT_COLOR}}"{% endif %}>
<html lang="en" {% if not IS_FISTMAS() %}style="--primary:#{{v.themecolor if v else DEFAULT_COLOR}}"{% endif %}>
<head>
{% block head %}
<meta charset="utf-8">

View File

@ -22,7 +22,7 @@
<li><small>Disables the effects of cosmetic awards.</small></li>
<li><small>Hides signatures.</small></li>
<li><small>Makes emoji search only start when you press Enter.</small></li>
{% if IS_FISTMAS %}
{% if IS_FISTMAS() %}
<li><small>Disables event music.</small></li>
{% endif %}
</ul>

View File

@ -25,7 +25,7 @@
<a class="sidebar-link" href="/log" data-bs-toggle="tooltip" data-bs-placement="top" title="Moderation Log"><i class="fas fa-scroll-old"></i></a>
<a class="sidebar-link" href="/transfers" data-bs-toggle="tooltip" data-bs-placement="top" title="Transfers"><i class="fas fa-arrow-right-arrow-left"></i></a>
<a class="sidebar-link" href="/random_post" data-bs-toggle="tooltip" data-bs-placement="top" title="Random Post"><i class="fas fa-random"></i></a>
{% if IS_FISTMAS %}
{% if IS_FISTMAS() %}
<span class="sidebar-link" data-nonce="{{g.nonce}}" data-onclick="postToastRoastEventDarkmode(this, '/events/fistmas2022/darkmode')" style="display:inline" data-bs-toggle="tooltip" data-bs-placement="top" title="Toggle Dark Mode"><i class="fas fa-moon-over-sun"></i></span>
{% endif %}
</p>
@ -87,6 +87,6 @@
</div>
</div>
{% if IS_FISTMAS %}
{% if IS_FISTMAS() %}
<script defer src="{{'fistmas/js/darkmode.js' | asset}}"></script>
{% endif %}

View File

@ -8,7 +8,7 @@
{% if sub %}
{% set image=sub.sidebar_url %}
{% elif IS_FISTMAS %}
{% elif IS_FISTMAS() %}
{% set image = macros.random_image("assets/fistmas/images/sidebar") %}
{% else %}
{% set image = macros.random_image("assets/images/" ~ SITE_NAME ~ "/sidebar") %}
@ -34,7 +34,7 @@
<a class="sidebar-link" href="/log" data-bs-toggle="tooltip" data-bs-placement="top" title="Moderation Log"><i class="fas fa-scroll-old"></i></a>
<a class="sidebar-link" href="/transfers" data-bs-toggle="tooltip" data-bs-placement="top" title="Transfers"><i class="fas fa-arrow-right-arrow-left"></i></a>
<a class="sidebar-link" href="/random_post" data-bs-toggle="tooltip" data-bs-placement="top" title="Random Post"><i class="fas fa-random"></i></a>
{% if IS_FISTMAS %}
{% if IS_FISTMAS() %}
<span class="sidebar-link" data-nonce="{{g.nonce}}" data-onclick="postToastRoastEventDarkmode(this, '/events/fistmas2022/darkmode')" style="display:inline" data-bs-toggle="tooltip" data-bs-placement="top" title="Toggle Dark Mode"><i class="fas fa-moon-over-sun"></i></span>
{% endif %}
</p>
@ -75,6 +75,6 @@
</div>
</div>
{% if IS_FISTMAS %}
{% if IS_FISTMAS() %}
<script defer src="{{'fistmas/js/darkmode.js' | asset}}"></script>
{% endif %}

View File

@ -28,7 +28,7 @@
<div id="username" class="d-none">{{u.username}}</div>
{% endif %}
<script defer src="{{'js/userpage.js' | asset}}"></script>
{% if not IS_FISTMAS or SITE_NAME == 'WPD' %}
{% if not IS_FISTMAS() or SITE_NAME == 'WPD' %}
<script defer src="{{'js/profile_song.js' | asset}}"></script>
{% endif %}
{% endblock %}

View File

@ -99,7 +99,7 @@
{% if v.agendaposter %}
<link rel="stylesheet" href="{{('css/agendaposter.css') | asset}}">
{% endif %}
{% if include_user_css and not IS_FISTMAS %}
{% if include_user_css and not IS_FISTMAS() %}
{% if v.theme == 'classic_dark' %}
<link rel="stylesheet" href="{{('css/classic.css') | asset}}">
{% endif %}
@ -123,7 +123,7 @@
<link rel="stylesheet" href="/h/{{sub}}/css">
{% endif %}
{% if IS_FISTMAS %}
{% if IS_FISTMAS() %}
<link rel="stylesheet" href="{{'fistmas/css/fistmas.css' | asset}}">
{% if v and v.event_darkmode %}