Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

notes include round id #4030

Merged
merged 2 commits into from
Jul 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
26 changes: 16 additions & 10 deletions code/datums/entities/player_note.dm
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
#define NOTE_ROUND_ID(note_entity) note_entity.round_id ? "(ID: [note_entity.round_id])" : ""

/datum/entity/player_note
var/player_id
var/admin_id
var/text
var/date
var/round_id
var/is_ban = FALSE
var/ban_time
var/is_confidential = FALSE
Expand All @@ -19,15 +22,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 +68,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 +84,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 +94,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] [NOTE_ROUND_ID(N)]</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] [NOTE_ROUND_ID(N)]</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] [NOTE_ROUND_ID(N)]</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] [NOTE_ROUND_ID(N)]</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] [NOTE_ROUND_ID(N)]</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] [NOTE_ROUND_ID(N)]</i></font> "
dat += "<br><br>"

dat += "<br>"
Expand Down
Loading