[Ready] Database Tickets (#48727)

* DB ticket procs

* Schema changes for DB tickets

* Schema version update

* Fixes requested by Jordie

* SQL updates

Adds a recipient column

* Still one dangling issue where this DOESN'T WORK

* Alright, this should work

* Requested SQL fixes

* Rogue changes

* less bad defaults

* utf8 for the utf8 gods

* aaaaaa

* Update tgstation_schema_prefixed.sql

* Update tgstation_schema.sql

* Update database_changelog.txt

Co-authored-by: Jordie <4343468+Jordie0608@users.noreply.github.com>
This commit is contained in:
Nick
2020-01-17 05:35:16 +11:00
committed by Jordie
co-authored by Jordie
parent 3195ceaa22
commit c758bdd51c
7 changed files with 95 additions and 6 deletions
+8 -1
View File
@@ -108,11 +108,13 @@ GLOBAL_DATUM_INIT(ahelp_tickets, /datum/admin_help_tickets, new)
if(C.current_ticket)
C.current_ticket.initiator = C
C.current_ticket.AddInteraction("Client reconnected.")
SSblackbox.LogAhelp(C.current_ticket.id, "Reconnected", "Client reconnected", C.ckey)
//Dissasociate ticket
/datum/admin_help_tickets/proc/ClientLogout(client/C)
if(C.current_ticket)
C.current_ticket.AddInteraction("Client disconnected.")
SSblackbox.LogAhelp(C.current_ticket.id, "Disconnected", "Client disconnected", C.ckey)
C.current_ticket.initiator = null
C.current_ticket = null
@@ -201,7 +203,6 @@ GLOBAL_DATUM_INIT(ahelp_tickets, /datum/admin_help_tickets, new)
if(admin_number_present <= 0)
to_chat(C, "<span class='notice'>No active admins are online, your adminhelp was sent through TGS to admins who are available. This may use IRC or Discord.</span>")
heard_by_no_admins = TRUE
GLOB.ahelp_tickets.active_tickets += src
/datum/admin_help/Destroy()
@@ -269,6 +270,7 @@ GLOBAL_DATUM_INIT(ahelp_tickets, /datum/admin_help_tickets, new)
//show it to the person adminhelping too
to_chat(initiator, "<span class='adminnotice'>PM to-<b>Admins</b>: <span class='linkify'>[msg]</span></span>")
SSblackbox.LogAhelp(id, "Ticket Opened", msg, null, initiator.ckey)
//Reopen a closed ticket
/datum/admin_help/proc/Reopen()
@@ -298,6 +300,7 @@ GLOBAL_DATUM_INIT(ahelp_tickets, /datum/admin_help_tickets, new)
var/msg = "<span class='adminhelp'>Ticket [TicketHref("#[id]")] reopened by [key_name_admin(usr)].</span>"
message_admins(msg)
log_admin_private(msg)
SSblackbox.LogAhelp(id, "Reopened", "Reopened by [usr.key]", usr.ckey)
SSblackbox.record_feedback("tally", "ahelp_stats", 1, "reopened")
TicketPanel() //can only be done from here, so refresh it
@@ -323,6 +326,7 @@ GLOBAL_DATUM_INIT(ahelp_tickets, /datum/admin_help_tickets, new)
SSblackbox.record_feedback("tally", "ahelp_stats", 1, "closed")
var/msg = "Ticket [TicketHref("#[id]")] closed by [key_name]."
message_admins(msg)
SSblackbox.LogAhelp(id, "Closed", "Closed by [usr.key]", null, usr.ckey)
log_admin_private(msg)
//Mark open ticket as resolved/legitimate, returns ahelp verb
@@ -341,6 +345,7 @@ GLOBAL_DATUM_INIT(ahelp_tickets, /datum/admin_help_tickets, new)
SSblackbox.record_feedback("tally", "ahelp_stats", 1, "resolved")
var/msg = "Ticket [TicketHref("#[id]")] resolved by [key_name]"
message_admins(msg)
SSblackbox.LogAhelp(id, "Resolved", "Resolved by [usr.key]", null, usr.ckey)
log_admin_private(msg)
//Close and return ahelp verb, use if ticket is incoherent
@@ -362,6 +367,7 @@ GLOBAL_DATUM_INIT(ahelp_tickets, /datum/admin_help_tickets, new)
message_admins(msg)
log_admin_private(msg)
AddInteraction("Rejected by [key_name].")
SSblackbox.LogAhelp(id, "Rejected", "Rejected by [usr.key]", null, usr.ckey)
Close(silent = TRUE)
//Resolve ticket with IC Issue message
@@ -380,6 +386,7 @@ GLOBAL_DATUM_INIT(ahelp_tickets, /datum/admin_help_tickets, new)
message_admins(msg)
log_admin_private(msg)
AddInteraction("Marked as IC issue by [key_name]")
SSblackbox.LogAhelp(id, "IC Issue", "Marked as IC issue by [usr.key]", null, usr.ckey)
Resolve(silent = TRUE)
//Show the ticket panel
+9 -1
View File
@@ -159,12 +159,13 @@
admin_ticket_log(src, interaction_message)
if(recipient != src) //reeee
admin_ticket_log(recipient, interaction_message)
SSblackbox.LogAhelp(current_ticket.id, "Reply", msg, recipient.ckey, src.ckey)
else //recipient is an admin but sender is not
var/replymsg = "Reply PM from-<b>[key_name(src, recipient, 1)]</b>: <span class='linkify'>[keywordparsedmsg]</span>"
admin_ticket_log(src, "<font color='red'>[replymsg]</font>")
to_chat(recipient, "<span class='danger'>[replymsg]</span>")
to_chat(src, "<span class='notice'>PM to-<b>Admins</b>: <span class='linkify'>[msg]</span></span>")
SSblackbox.LogAhelp(current_ticket.id, "Reply", msg, recipient.ckey, src.ckey)
//play the receiving admin the adminhelp sound (if they have them enabled)
if(recipient.prefs.toggles & SOUND_ADMINHELP)
@@ -172,8 +173,11 @@
else
if(holder) //sender is an admin but recipient is not. Do BIG RED TEXT
var/already_logged = FALSE
if(!recipient.current_ticket)
new /datum/admin_help(msg, recipient, TRUE)
already_logged = TRUE
SSblackbox.LogAhelp(recipient.current_ticket.id, "Ticket Opened", msg, null, recipient.ckey)
to_chat(recipient, "<font color='red' size='4'><b>-- Administrator private message --</b></font>")
to_chat(recipient, "<span class='adminsay'>Admin PM from-<b>[key_name(src, recipient, 0)]</b>: <span class='linkify'>[msg]</span></span>")
@@ -182,6 +186,10 @@
admin_ticket_log(recipient, "<font color='purple'>PM From [key_name_admin(src)]: [keywordparsedmsg]</font>")
if(!already_logged) //Reply to an existing ticket
SSblackbox.LogAhelp(recipient.current_ticket.id, "Reply", msg, recipient.ckey, src.ckey)
//always play non-admin recipients the adminhelp sound
SEND_SOUND(recipient, sound('sound/effects/adminhelp.ogg'))