From 656abd155bfde2d8282dc8a3c816784b23daf353 Mon Sep 17 00:00:00 2001 From: Timberpoes Date: Tue, 6 Sep 2022 05:25:11 +0100 Subject: [PATCH] Fixes role banned players not being banned from roles that they are banned from (Option Two) (#69703) I feex --- code/controllers/subsystem/ban_cache.dm | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/code/controllers/subsystem/ban_cache.dm b/code/controllers/subsystem/ban_cache.dm index 45b524ccf6d..523af2ef281 100644 --- a/code/controllers/subsystem/ban_cache.dm +++ b/code/controllers/subsystem/ban_cache.dm @@ -19,17 +19,28 @@ SUBSYSTEM_DEF(ban_cache) return var/current_time = REALTIMEOFDAY var/list/look_for = list() + + var/list/query_args = list() + var/list/query_arg_keys = list() + + var/num_keys = 0 for(var/ckey in GLOB.directory) var/client/lad = GLOB.directory[ckey] // If they've already got a ban cached, or a request goin, don't do it if(lad.ban_cache || lad.ban_cache_start) continue + look_for += ckey lad.ban_cache_start = current_time + + query_args += list("key[num_keys]" = ckey) + query_arg_keys += ":key[num_keys]" + num_keys++ + // We're gonna try and make a query for clients var/datum/db_query/query_batch_ban_cache = SSdbcore.NewQuery( - "SELECT ckey, role, applies_to_admins FROM [format_table_name("ban")] WHERE ckey IN (:ckeys) AND unbanned_datetime IS NULL AND (expiration_time IS NULL OR expiration_time > NOW())", - list("ckeys" = look_for.Join(",")) + "SELECT ckey, role, applies_to_admins FROM [format_table_name("ban")] WHERE ckey IN ([query_arg_keys.Join(",")]) AND unbanned_datetime IS NULL AND (expiration_time IS NULL OR expiration_time > NOW())", + query_args ) var/succeeded = query_batch_ban_cache.Execute()