chat: fix cache commit and stuff idk

pull/31/head
justcool393 2022-11-29 16:02:27 -06:00
parent d79ad8c1f0
commit 80466f3150
3 changed files with 10 additions and 3 deletions

View File

@ -10,7 +10,7 @@ from files.helpers.const import *
from files.helpers.settings import get_settings
from files.helpers.sorting_and_time import make_age_string
from files.routes.routehelpers import get_formkey
from files.routes.wrappers import calc_users
from files.routes.wrappers import calc_users, calc_chat_users
from files.__main__ import app, cache
@app.template_filter("formkey")
@ -56,7 +56,7 @@ def inject_constants():
"BADGE_THREAD":BADGE_THREAD, "SNAPPY_THREAD":SNAPPY_THREAD,
"KOFI_TOKEN":KOFI_TOKEN, "KOFI_LINK":KOFI_LINK,
"approved_embed_hosts":approved_embed_hosts,
"site_settings":get_settings(), "EMAIL":EMAIL, "calc_users":calc_users,
"site_settings":get_settings(), "EMAIL":EMAIL, "calc_users":calc_users, "calc_chat_users":calc_chat_users,
"max": max, "min": min, "user_can_see":User.can_see,
"TELEGRAM_LINK":TELEGRAM_LINK, "EMAIL_REGEX_PATTERN":EMAIL_REGEX_PATTERN,
"TRUESCORE_DONATE_MINIMUM":TRUESCORE_DONATE_MINIMUM,

View File

@ -43,7 +43,13 @@ def calc_users(v):
g.loggedin_counter = len(loggedin)
g.loggedout_counter = len(loggedout)
g.loggedin_chat = cache.get(CHAT_ONLINE_CACHE_KEY)
return ''
def calc_chat_users():
if g.is_api_or_xhr:
g.loggedin_chat = 0
else:
g.loggedin_chat = cache.get(CHAT_ONLINE_CACHE_KEY, 0)
return ''
def get_logged_in_user():

View File

@ -1,3 +1,4 @@
{{calc_chat_users()}}
<div class="container d-inline-flex d-lg-none">
<div class="row fixed-bottom bg-white border-top p-2" id="mobile-bottom-navigation-bar"
style="z-index: 1000; bottom: 0px; transition: bottom cubic-bezier(0, 0, 0.2, 1) 220ms;">