Feedback & Little Fixes

This commit is contained in:
Selis
2023-06-21 13:55:44 +02:00
parent 67ba4a2de5
commit 8f1f1f6d58
11 changed files with 263 additions and 38 deletions
@@ -0,0 +1,48 @@
/datum/tgui_feedback
var/selected_window
/datum/tgui_feedback/tgui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "TguiFeedback", "TGUI Feedback Submission")
ui.open()
/datum/tgui_feedback/tgui_state(mob/user)
return GLOB.tgui_always_state
/datum/tgui_feedback/tgui_static_data(mob/user)
var/list/data = list()
data["open_windows"] = list()
for(var/datum/tgui/ui in user.tgui_open_uis)
data["open_windows"] += ui.title
return data
/datum/tgui_feedback/tgui_data(mob/user)
var/list/data = list()
data["selected_window"] = selected_window
return data
/datum/tgui_feedback/tgui_act(action, params)
if(..())
return
switch(action)
if("pick_window")
if(!params["win"])
return
selected_window = sanitize(params["win"])
. = TRUE
if("submit")
message_admins("TGUI Feedback: Rating [params["rating"]] - Comment: [params["comment"]]")
. = TRUE
/client/verb/tgui_feedback()
set name = "Submit TGUI Feedback"
set category = "OOC"
var/datum/tgui_feedback/feedback = new()
feedback.tgui_interact(usr)
@@ -129,11 +129,13 @@ GLOBAL_DATUM_INIT(tickets, /datum/tickets, new)
if(C.current_ticket)
C.current_ticket.AddInteraction("Client reconnected.")
C.current_ticket.initiator = C
C.current_ticket.initiator.mob.throw_alert("open ticket", /obj/screen/alert/open_ticket)
//Dissasociate ticket
/datum/tickets/proc/ClientLogout(client/C)
if(C.current_ticket)
C.current_ticket.AddInteraction("Client disconnected.")
C.current_ticket.initiator.mob.clear_alert("open ticket")
C.current_ticket.initiator = null
C.current_ticket = null
@@ -430,7 +432,7 @@ GLOBAL_DATUM_INIT(tickets, /datum/tickets, new)
message_admins(msg)
log_admin(msg)
feedback_inc("ticket_reopen")
TicketPanel() //can only be done from here, so refresh it
//TicketPanel() //can only be done from here, so refresh it
SSwebhooks.send(
WEBHOOK_AHELP_SENT,
@@ -473,7 +475,7 @@ GLOBAL_DATUM_INIT(tickets, /datum/tickets, new)
"color" = COLOR_WEBHOOK_BAD
)
)
initiator.mob.clear_alert("open ticket")
initiator?.mob?.clear_alert("open ticket")
//Mark open ticket as resolved/legitimate, returns ahelp verb
/datum/ticket/proc/Resolve(silent = FALSE)
@@ -504,6 +506,7 @@ GLOBAL_DATUM_INIT(tickets, /datum/tickets, new)
"color" = COLOR_WEBHOOK_GOOD
)
)
initiator?.mob?.clear_alert("open ticket")
//Close and return ahelp verb, use if ticket is incoherent
/datum/ticket/proc/Reject(key_name = key_name_admin(usr))
@@ -596,7 +599,7 @@ GLOBAL_DATUM_INIT(tickets, /datum/tickets, new)
var/msg = "Ticket [TicketHref("#[id]")] titled [name] by [key_name_admin(usr)]"
message_admins(msg)
log_admin(msg)
TicketPanel() //we have to be here to do this
//TicketPanel() //we have to be here to do this
//Kick ticket to next level
/datum/ticket/proc/Escalate()
@@ -37,7 +37,7 @@
return
switch(action)
if("send_msg")
if(params["msg"])
if(!params["msg"])
return
usr.client.cmd_admin_pm(usr.client, sanitize(params["msg"]), T)
@@ -104,11 +104,11 @@
TicketListLegacy(choice)
. = TRUE
if("new_ticket")
var/list/ckeys
var/list/ckeys = list()
for(var/client/C in GLOB.clients)
ckeys += C.ckey
ckeys += C.key
var/ckey = tgui_input_list(usr, "Please select the ckey of the user.", "Select CKEY", ckeys)
var/ckey = lowertext(tgui_input_list(usr, "Please select the ckey of the user.", "Select CKEY", ckeys))
if(!ckey)
return
@@ -121,22 +121,21 @@
to_chat(usr, "<span class='warning'>Ckey ([ckey]) not online.</span>")
return
var/msg = tgui_input_text(usr, "What should the initial text be?", "New Ticket")
if(!msg)
var/ticket_text = tgui_input_text(usr, "What should the initial text be?", "New Ticket")
if(!ticket_text)
to_chat(usr, "<span class='warning'>Ticket message cannot be empty.</span>")
return
var/level = tgui_input_text(usr, "What level is the ticket? 0 = ADMIN, 1 = MENTOR", "Ticket Level")
if(level != "0" && level != "1")
to_chat(usr, "<span class='warning'>Invalid ticket level: [level].</span>")
var/level = tgui_alert(usr, "Is this ticket Admin-Level or Mentor-Level?", "Ticket Level", list("Admin", "Mentor"))
if(!level)
return
feedback_add_details("admin_verb","Admincreatedticket") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
if(player.current_ticket)
if(tgui_alert(usr, "The player already has a ticket open. Is this for the same issue?","Duplicate?",list("Yes","No")) != "No")
if(player.current_ticket)
player.current_ticket.MessageNoRecipient(msg)
to_chat(usr, "<span class='adminnotice'>PM to-<b>Admins</b>: [msg]</span>")
player.current_ticket.MessageNoRecipient(ticket_text)
to_chat(usr, "<span class='adminnotice'>PM to-<b>Admins</b>: [ticket_text]</span>")
return
else
to_chat(usr, "<span class='warning'>Ticket not found, creating new one...</span>")
@@ -144,7 +143,14 @@
player.current_ticket.AddInteraction("[key_name_admin(usr)] opened a new ticket.")
player.current_ticket.Close()
new /datum/ticket(msg, player, TRUE, level)
// Create a new ticket and handle it. You created it afterall!
var/datum/ticket/T = new /datum/ticket(ticket_text, player, TRUE, level)
if(level == "Admin")
T.level = 0
else
T.level = 1
T.HandleIssue()
usr.client.cmd_admin_pm(player, ticket_text, T)
. = TRUE
if("pick_ticket")
var/datum/ticket/T = ID2Ticket(params["ticket_id"])
@@ -160,6 +166,12 @@
usr.client.selected_ticket.tgui_interact(usr)
usr.client.selected_ticket = null
. = TRUE
if("send_msg")
if(!params["msg"])
return
usr.client.cmd_admin_pm(usr.client.selected_ticket.initiator, sanitize(params["msg"]), usr.client.selected_ticket)
. = TRUE
/datum/tickets/tgui_fallback(payload)
if(..())
@@ -190,6 +202,7 @@
var/ref_src = "\ref[src]"
data["title"] = name
data["name"] = LinkedReplyName(ref_src)
data["ticket_ref"] = ref_src
switch(state)
if(AHELP_ACTIVE)
@@ -229,6 +242,14 @@
if("legacy")
TicketPanelLegacy()
. = TRUE
if("send_msg")
if(!params["msg"] || !params["ticket_ref"])
return
var/datum/ticket/T = locate(params["ticket_ref"])
usr.client.cmd_admin_pm(T.initiator, sanitize(params["msg"]), T)
. = TRUE
/datum/ticket/tgui_fallback(payload)
if(..())