decouple v.last_active from the calc_users

remotes/1693176582716663532/tmp_refs/heads/watchparty
Aevann1 2022-10-15 12:08:14 +02:00
parent 39aa59a37a
commit 6465982580
2 changed files with 9 additions and 7 deletions

View File

@ -15,11 +15,6 @@ def calc_users(v):
if v:
if session["session_id"] in loggedout: del loggedout[session["session_id"]]
loggedin[v.id] = timestamp
# Check against last_active + ACTIVE_TIME to reduce frequency of
# UPDATEs in exchange for a ±ACTIVE_TIME margin of error.
if (v.last_active + LOGGEDIN_ACTIVE_TIME) < timestamp:
v.last_active = timestamp
g.db.add(v)
else:
ua = str(user_agents.parse(g.agent))
if 'spider' not in ua.lower() and 'bot' not in ua.lower():
@ -75,7 +70,14 @@ def get_logged_in_user():
g.v = v
if v: v.poor = session.get('poor')
if v:
v.poor = session.get('poor')
# Check against last_active + ACTIVE_TIME to reduce frequency of
# UPDATEs in exchange for a ±ACTIVE_TIME margin of error.
timestamp = int(time.time())
if (v.last_active + LOGGEDIN_ACTIVE_TIME) < timestamp:
v.last_active = timestamp
g.db.add(v)
if AEVANN_ID and request.headers.get("Cf-Ipcountry") == 'EG':
if v and not v.username.startswith('Aev'):

View File

@ -255,7 +255,7 @@ def comment(v):
if parent.author.any_block_exists(v) and v.admin_level < PERMS['POST_COMMENT_MODERATION']:
abort(403, "You can't reply to users who have blocked you or users that you have blocked.")
is_bot = v.id != BBBB_ID and v.client or (SITE == 'pcmemes.net' and v.id == SNAPPY_ID))
is_bot = v.id != BBBB_ID and v.client or (SITE == 'pcmemes.net' and v.id == SNAPPY_ID)
execute_antispam_comment_check(body, v)