only call calc_users when its necessary
parent
42847cf5ca
commit
f1856a6ec2
|
@ -50,7 +50,9 @@ def front_all(v, sub=None):
|
|||
|
||||
if not v:
|
||||
result = cache.get(f'frontpage_{sort}_{t}_{page}_{sub}_{pins}')
|
||||
if result: return result
|
||||
if result:
|
||||
calc_users()
|
||||
return result
|
||||
|
||||
ids, total, size = frontlist(sort=sort,
|
||||
page=page,
|
||||
|
|
|
@ -11,6 +11,7 @@ from files.helpers.config.const import *
|
|||
from files.helpers.regex import *
|
||||
from files.helpers.settings import *
|
||||
from files.helpers.cloudflare import *
|
||||
from files.helpers.wrappers import calc_users
|
||||
from files.helpers.sorting_and_time import make_age_string
|
||||
from files.routes.routehelpers import get_alt_graph, get_formkey
|
||||
from files.__main__ import app, cache
|
||||
|
@ -121,5 +122,5 @@ def inject_constants():
|
|||
"BIO_FRIENDS_ENEMIES_LENGTH_LIMIT":BIO_FRIENDS_ENEMIES_LENGTH_LIMIT,
|
||||
"IMMUNE_TO_AWARDS": IMMUNE_TO_AWARDS, "SITE_FULL_IMAGES": SITE_FULL_IMAGES,
|
||||
"IS_FISTMAS":IS_FISTMAS, "IS_HOMOWEEN":IS_HOMOWEEN, "IS_DKD":IS_DKD, "IS_EVENT":IS_EVENT, "IS_BIRTHGAY":IS_BIRTHGAY,
|
||||
"CHUD_PHRASES":CHUD_PHRASES, "hasattr":hasattr,
|
||||
"CHUD_PHRASES":CHUD_PHRASES, "hasattr":hasattr, "calc_users":calc_users,
|
||||
}
|
||||
|
|
|
@ -103,7 +103,9 @@ def post_id(pid, anything=None, v=None, sub=None):
|
|||
|
||||
if not v:
|
||||
result = cache.get(f'post_{p.id}_{sort}')
|
||||
if result: return result
|
||||
if result:
|
||||
calc_users()
|
||||
return result
|
||||
|
||||
if v:
|
||||
execute_shadowban_viewers_and_voters(v, p)
|
||||
|
|
|
@ -119,8 +119,6 @@ def get_logged_in_user():
|
|||
|
||||
g.is_api_or_xhr = bool((v and v.client) or request.headers.get("xhr"))
|
||||
|
||||
calc_users()
|
||||
|
||||
return v
|
||||
|
||||
def auth_desired(f):
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
<nav class="shadow-md fixed-top">
|
||||
<div class="srd">
|
||||
{{calc_users()}}
|
||||
{% if SITE_NAME == 'rDrama' %}
|
||||
{% if not hasattr(g, "loggedin_counter") or (range(1,5) | random == 1 and not (v and v.truescore > 1000)) %}
|
||||
{% include "journoid_banner.html" %}
|
||||
|
|
Loading…
Reference in New Issue