Prevents joining with unacked notifications (#11398)

This commit is contained in:
Werner
2021-03-07 22:00:38 +01:00
committed by GitHub
parent 0a80d0053f
commit 39323cc722
5 changed files with 61 additions and 7 deletions

View File

@@ -285,11 +285,20 @@
return
if (!dbcon.IsConnected())
return
var/count = 0
var/DBQuery/warning_count_query = dbcon.NewQuery("SELECT COUNT(*) FROM ss13_warnings WHERE (visible = 1 AND acknowledged = 0 AND expired = 0) AND (ckey = :ckey: OR computerid = :computer_id: OR ip = :address:)")
warning_count_query.Execute(list("ckey" = ckey, "computer_id" = computer_id, "address" = address))
if(warning_count_query.NextRow())
unacked_warning_count = text2num(warning_count_query.item[1])
return unacked_warning_count
count += text2num(warning_count_query.item[1])
var/DBQuery/notification_count_query = dbcon.NewQuery("SELECT COUNT(*) FROM ss13_player_notifications WHERE ckey = :ckey: AND acked_at is NULL and type IN ('player_greeting','player_greeting_chat')")
notification_count_query.Execute(list("ckey" = ckey))
if(notification_count_query.NextRow())
count += text2num(notification_count_query.item[1])
unacked_warning_count = count
return unacked_warning_count
/*
* A proc for an admin/moderator to look up a member's warnings.