Add support for adminwho name links (using DB) (#66909)

I shamelessly farm GBP

Co-authored-by: Aleksej Komarov <stylemistake@gmail.com>
This commit is contained in:
magatsuchi
2022-05-17 19:49:46 +03:00
committed by GitHub
co-authored by Aleksej Komarov
parent dc68951d37
commit 166fa8e125
2 changed files with 63 additions and 34 deletions
+23 -1
View File
@@ -29,6 +29,11 @@ GLOBAL_PROTECT(href_token)
var/href_token
/// Link from the database pointing to the admin's feedback forum
var/cached_forum_link
/// Last access time in deciseconds (playing nice with the MSO 10 second rule)
var/last_forum_access_time
var/deadmined
var/datum/filter_editor/filteriffic
@@ -165,12 +170,29 @@ GLOBAL_PROTECT(href_token)
owner.holder = null
owner = null
/// Returns the feedback forum thread for the admin holder's owner, as according to DB.
/datum/admins/proc/feedback_link()
if(world.time - last_forum_access_time <= 10 SECONDS)
return cached_forum_link
last_forum_access_time = world.time
var/datum/db_query/feedback_query = SSdbcore.NewQuery("SELECT feedback FROM [format_table_name("admin")] WHERE ckey = '[owner.ckey]'")
if(!feedback_query.Execute())
log_sql("Error retrieving feedback link for [src]")
return cached_forum_link
if(!feedback_query.NextRow())
return FALSE // no feedback link exists
cached_forum_link = feedback_query.item[1]
return cached_forum_link
/datum/admins/proc/check_for_rights(rights_required)
if(rights_required && !(rights_required & rank_flags()))
return FALSE
return TRUE
/datum/admins/proc/check_if_greater_rights_than_holder(datum/admins/other)
if(!other)
return TRUE //they have no rights