From a9f7acedd244b065d1920ac18683f995df522638 Mon Sep 17 00:00:00 2001
From: wesoda25 <37246588+wesoda25@users.noreply.github.com>
Date: Sun, 3 Apr 2022 18:57:29 -0400
Subject: [PATCH] Slight change to admin messages, ensuring people actually see
and read them (take 2) (#65871)
Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
---
code/modules/admin/sql_message_system.dm | 11 +----------
code/modules/admin/topic.dm | 13 +++++++++++++
2 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/code/modules/admin/sql_message_system.dm b/code/modules/admin/sql_message_system.dm
index 9ab87f5c218..a1f500b9bce 100644
--- a/code/modules/admin/sql_message_system.dm
+++ b/code/modules/admin/sql_message_system.dm
@@ -669,16 +669,7 @@
switch(type)
if("message")
output += "Admin message left by [span_prefix("[admin_key]")] on [timestamp]"
- output += "
[text]
"
- var/datum/db_query/query_message_read = SSdbcore.NewQuery(
- "UPDATE [format_table_name("messages")] SET type = 'message sent' WHERE id = :id",
- list("id" = message_id)
- )
- if(!query_message_read.warn_execute())
- qdel(query_get_message_output)
- qdel(query_message_read)
- return
- qdel(query_message_read)
+ output += "
[text] (Click here to verify you have read this message)
"
if("note")
output += "Note left by [span_prefix("[admin_key]")] on [timestamp]"
output += "
[text]
"
diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm
index 862d79911ac..d808d85eb99 100644
--- a/code/modules/admin/topic.dm
+++ b/code/modules/admin/topic.dm
@@ -400,6 +400,19 @@
var/target = href_list["showmessageckeylinkless"]
browse_messages(target_ckey = target, linkless = 1)
+ else if(href_list["messageread"])
+ if(!isnum(href_list["message_id"]))
+ return
+ var/rounded_message_id = round(href_list["message_id"], 1)
+ var/datum/db_query/query_message_read = SSdbcore.NewQuery(
+ "UPDATE [format_table_name("messages")] SET type = 'message sent' WHERE usr.key = :player_key AND id = :id",
+ list("id" = rounded_message_id)
+ )
+ if(!query_message_read.warn_execute())
+ qdel(query_message_read)
+ return
+ qdel(query_message_read)
+
else if(href_list["messageedits"])
if(!check_rights(R_ADMIN))
return