From 6dfe650f1ac90c7c22db0d461b95125bf276644b Mon Sep 17 00:00:00 2001 From: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com> Date: Mon, 25 Apr 2022 09:34:40 -0400 Subject: [PATCH] Finally fixed the issues with handling ahelps (#13078) * Finally fixed the issues with handling ahelps * Applied suggestion Co-authored-by: Zonespace <41448081+Zonespace27@users.noreply.github.com> Co-authored-by: Zonespace <41448081+Zonespace27@users.noreply.github.com> --- code/modules/admin/verbs/adminhelp.dm | 12 +++++++----- code/modules/admin/verbs/adminpm.dm | 11 +++-------- modular_skyrat/modules/admin/code/admin_help.dm | 9 +++++---- 3 files changed, 15 insertions(+), 17 deletions(-) diff --git a/code/modules/admin/verbs/adminhelp.dm b/code/modules/admin/verbs/adminhelp.dm index 4e553fe7b23..3ed1e120799 100644 --- a/code/modules/admin/verbs/adminhelp.dm +++ b/code/modules/admin/verbs/adminhelp.dm @@ -394,7 +394,7 @@ GLOBAL_DATUM_INIT(ahelp_tickets, /datum/admin_help_tickets, new) . += " (IC)" . += " (CLOSE)" . += " (RSLVE)" - . += " (HANDLE)" //SKYRAT EDIT ADDITION - ADMIN + . += " (HANDLE)" //SKYRAT EDIT ADDITION - ADMIN . += " (PING MUTE)" //SKYRAT EDIT //private @@ -671,8 +671,10 @@ GLOBAL_DATUM_INIT(ahelp_tickets, /datum/admin_help_tickets, new) if("reject") Reject() if("reply") - HandleIssue() /// SKYRAT EDIT ADDITION - ADMIN HANDLE - usr.client.cmd_ahelp_reply(initiator) + // SKYRAT EDIT START - ADMIN HANDLE + if(handle_issue()) + usr?.client.cmd_ahelp_reply(initiator) + // SKYRAT EDIT END if("icissue") ICIssue() if("close") @@ -682,8 +684,8 @@ GLOBAL_DATUM_INIT(ahelp_tickets, /datum/admin_help_tickets, new) if("reopen") Reopen() //SKYRAT EDIT ADDITION BEING - ADMIN - if("handleissue") - HandleIssue() + if("handle_issue") + handle_issue() if("pingmute") ticket_ping_stop = !ticket_ping_stop SSblackbox.record_feedback("tally", "ahelp_stats", 1, "pingmute") diff --git a/code/modules/admin/verbs/adminpm.dm b/code/modules/admin/verbs/adminpm.dm index 4a058cb59dc..15b067f67e3 100644 --- a/code/modules/admin/verbs/adminpm.dm +++ b/code/modules/admin/verbs/adminpm.dm @@ -269,14 +269,9 @@ SSblackbox.LogAhelp(recipient.current_ticket.id, "Ticket Opened", msg, recipient.ckey, src.ckey) //SKYRAT EDIT ADDITION BEGIN - ADMIN - if(recipient.current_ticket.handler) - if(recipient.current_ticket.handler != usr.ckey) - var/response = tgui_alert(usr, "This ticket is already being handled by [recipient.current_ticket.handler]. Do you want to continue?", "Ticket already assigned", list("Yes", "No")) - - if(response == "No") - return - else - recipient.current_ticket.HandleIssue() + // Basically, if we realized that we shouldn't've been handling the ticket, let's bail. Otherwise, we just change who's handling it. + if(!recipient.current_ticket.handle_issue()) + return //SKYRAT EDIT ADDITION END to_chat(recipient, diff --git a/modular_skyrat/modules/admin/code/admin_help.dm b/modular_skyrat/modules/admin/code/admin_help.dm index 35b72b437a3..e15385d1a87 100644 --- a/modular_skyrat/modules/admin/code/admin_help.dm +++ b/modular_skyrat/modules/admin/code/admin_help.dm @@ -3,17 +3,17 @@ var/list/_interactions_player //Let the initiator know their ahelp is being handled -/datum/admin_help/proc/HandleIssue(key_name = key_name_admin(usr)) +/datum/admin_help/proc/handle_issue(key_name = key_name_admin(usr)) if(state != AHELP_ACTIVE) - return + return FALSE if(handler && handler == usr.ckey) // No need to handle it twice as the same person ;) - return + return TRUE if(handler && handler != usr.ckey) var/response = tgui_alert(usr, "This ticket is already being handled by [handler]. Do you want to continue?", "Ticket already assigned", list("Yes", "No")) if(!response || response == "No") - return + return FALSE var/msg = span_adminhelp("Your ticket is now being handled by [usr?.client?.holder?.fakekey ? usr?.client?.holder?.fakekey : "an administrator"]! Please wait while they type their response and/or gather relevant information.") @@ -28,6 +28,7 @@ AddInteractionPlayer("Being handled by [key_name_admin(usr, FALSE)]") handler = "[usr.ckey]" + return TRUE /datum/admin_help/proc/PlayerTicketPanel() var/list/dat = list("Player Ticket")