Fixes role banned players not being banned from roles that they are banned from (Option Two) (#69703)

I feex
This commit is contained in:
Timberpoes
2022-09-06 05:25:11 +01:00
committed by GitHub
parent f5011f720f
commit 656abd155b
+13 -2
View File
@@ -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()