Skip to content

Commit

Permalink
notes have round ids
Browse files Browse the repository at this point in the history
  • Loading branch information
harryob committed Jul 28, 2023
1 parent b99e15d commit fbe612c
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 16 deletions.
1 change: 1 addition & 0 deletions code/datums/entities/player.dm
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ BSQL_PROTECT_DATUM(/datum/entity/player)
note.player_id = id
note.text = note_text
note.date = "[time2text(world.realtime, "YYYY-MM-DD hh:mm:ss")]"
note.round_id = GLOB.round_id
note.is_confidential = is_confidential
note.note_category = note_category
note.is_ban = is_ban
Expand Down
24 changes: 14 additions & 10 deletions code/datums/entities/player_note.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
var/admin_id
var/text
var/date
var/round_id = "N/A"
var/is_ban = FALSE
var/ban_time
var/is_confidential = FALSE
Expand All @@ -19,15 +20,16 @@ BSQL_PROTECT_DATUM(/datum/entity/player_note)
entity_type = /datum/entity/player_note
table_name = "player_notes"
field_types = list(
"player_id"=DB_FIELDTYPE_BIGINT,
"admin_id"=DB_FIELDTYPE_BIGINT,
"text"=DB_FIELDTYPE_STRING_MAX,
"date"=DB_FIELDTYPE_STRING_LARGE,
"is_ban"=DB_FIELDTYPE_INT,
"ban_time"=DB_FIELDTYPE_BIGINT,
"is_confidential"=DB_FIELDTYPE_INT,
"admin_rank"=DB_FIELDTYPE_STRING_MEDIUM,
"note_category" =DB_FIELDTYPE_INT,
"player_id" = DB_FIELDTYPE_BIGINT,
"admin_id" = DB_FIELDTYPE_BIGINT,
"text" = DB_FIELDTYPE_STRING_MAX,
"date" = DB_FIELDTYPE_STRING_LARGE,
"round_id" = DB_FIELDTYPE_BIGINT,
"is_ban" = DB_FIELDTYPE_INT,
"ban_time" = DB_FIELDTYPE_BIGINT,
"is_confidential" = DB_FIELDTYPE_INT,
"admin_rank" = DB_FIELDTYPE_STRING_MEDIUM,
"note_category" = DB_FIELDTYPE_INT,
)

/datum/entity_meta/player_note/on_read(datum/entity/player_note/note)
Expand Down Expand Up @@ -64,6 +66,7 @@ BSQL_PROTECT_DATUM(/datum/entity/player_note)
var/is_ban
var/admin_ckey
var/date
var/round_id
var/ban_time
var/is_confidential
var/admin_rank
Expand All @@ -79,6 +82,7 @@ BSQL_PROTECT_DATUM(/datum/entity/player_note)
"is_ban",
"admin_ckey" = "admin.ckey",
"date",
"round_id",
"ban_time",
"is_confidential",
"admin_rank",
Expand All @@ -88,4 +92,4 @@ BSQL_PROTECT_DATUM(/datum/entity/player_note)
/// Returns all notes associated with a CKEY, structured as a list of strings.
/proc/get_all_notes(player_ckey)
for(var/datum/view_record/note_view/note in DB_VIEW(/datum/view_record/note_view, DB_COMP("player_ckey", DB_EQUALS, player_ckey)))
LAZYADDASSOC(., "[note.note_category]", "\"[note.text]\", by [note.admin_ckey] ([note.admin_rank]) on [note.date]")
LAZYADDASSOC(., "[note.note_category]", "\"[note.text]\", by [note.admin_ckey] ([note.admin_rank]) on [note.date] ([note.round_id])")
4 changes: 2 additions & 2 deletions code/game/verbs/records.dm
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
if(NOTE_YAUTJA)
color = "#114e11"

dat += "<font color=[color]>[N.text]</font> <i>by [admin_ckey] ([N.admin_rank])</i> on <i><font color=blue>[N.date]</i></font> "
dat += "<font color=[color]>[N.text]</font> <i>by [admin_ckey] ([N.admin_rank])</i> on <i><font color=blue>[N.date] (ID: [N.round_id])</i></font> "
dat += "<br><br>"

dat += "<br>"
Expand Down Expand Up @@ -168,7 +168,7 @@
continue
var/admin_ckey = N.admin_ckey

dat += "<font color=[color]>[N.text]</font> <i>by [admin_ckey] ([N.admin_rank])</i> on <i><font color=blue>[N.date]</i></font> "
dat += "<font color=[color]>[N.text]</font> <i>by [admin_ckey] ([N.admin_rank])</i> on <i><font color=blue>[N.date] (ID: [N.round_id])</i></font> "
///Can remove notes from anyone other than yourself, unless you're the host. So long as you have deletion access anyway.
if((can_del && target != get_player_from_key(key)) || ishost(usr))
dat += "<A HREF='?_src_=admin_holder;[HrefToken(forceGlobal = TRUE)];remove_wl_info=[key];remove_index=[N.id]'>Remove</A>"
Expand Down
4 changes: 2 additions & 2 deletions code/modules/admin/admin.dm
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
if(N.is_ban)
var/time_d = N.ban_time ? "Banned for [N.ban_time] minutes | " : ""
color = "#880000" //Removed confidential check because we can't make confidential bans
dat += "<font color=[color]>[time_d][N.text]</font> <i>by [admin_ckey] ([N.admin_rank])</i>[confidential_text] on <i><font color=blue>[N.date]</i></font> "
dat += "<font color=[color]>[time_d][N.text]</font> <i>by [admin_ckey] ([N.admin_rank])</i>[confidential_text] on <i><font color=blue>[N.date] (ID: [N.round_id])</i></font> "
else
if(N.is_confidential)
color = "#AA0055"
Expand All @@ -102,7 +102,7 @@
else if(N.note_category == NOTE_YAUTJA)
color = "#114e11"

dat += "<font color=[color]>[N.text]</font> <i>by [admin_ckey] ([N.admin_rank])</i>[confidential_text] on <i><font color=blue>[N.date]</i></font> "
dat += "<font color=[color]>[N.text]</font> <i>by [admin_ckey] ([N.admin_rank])</i>[confidential_text] on <i><font color=blue>[N.date] (ID: [N.round_id])</i></font> "
if(admin_ckey == usr.ckey || admin_ckey == "Adminbot" || ishost(usr))
dat += "<A HREF='?_src_=admin_holder;[HrefToken(forceGlobal = TRUE)];remove_player_info=[key];remove_index=[N.id]'>Remove</A>"

Expand Down
4 changes: 2 additions & 2 deletions code/modules/admin/tabs/admin_tab.dm
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,12 @@
if(N.is_ban)
var/ban_text = N.ban_time ? "Banned for [N.ban_time] | " : ""
color = "#880000"
dat += "<font color=[color]>[ban_text][N.text]</font> <i>by [admin_ckey] ([N.admin_rank])</i>[confidential_text] on <i><font color=blue>[N.date]</i></font> "
dat += "<font color=[color]>[ban_text][N.text]</font> <i>by [admin_ckey] ([N.admin_rank])</i>[confidential_text] on <i><font color=blue>[N.date] (ID: [N.round_id])</i></font> "
else
if(N.is_confidential)
color = "#AA0055"

dat += "<font color=[color]>[N.text]</font> <i>by [admin_ckey] ([N.admin_rank])</i>[confidential_text] on <i><font color=blue>[N.date]</i></font> "
dat += "<font color=[color]>[N.text]</font> <i>by [admin_ckey] ([N.admin_rank])</i>[confidential_text] on <i><font color=blue>[N.date] (ID: [N.round_id])</i></font> "
dat += "<br><br>"

dat += "<br>"
Expand Down

0 comments on commit fbe612c

Please sign in to comment.