From f8260a9a8486d167c2e1b766dd0f6c69032e76a2 Mon Sep 17 00:00:00 2001 From: tkdrg Date: Sat, 1 Nov 2014 20:01:52 -0300 Subject: [PATCH] Adds logging and moderation to newscaster comments --- code/__HELPERS/_logging.dm | 7 ++++++- code/game/machinery/newscaster.dm | 22 +++++++++++++++++++++- code/modules/admin/admin.dm | 8 +++++++- code/modules/admin/topic.dm | 12 ++++++++++++ 4 files changed, 46 insertions(+), 3 deletions(-) diff --git a/code/__HELPERS/_logging.dm b/code/__HELPERS/_logging.dm index 03265398796..5a48ed236ca 100644 --- a/code/__HELPERS/_logging.dm +++ b/code/__HELPERS/_logging.dm @@ -70,4 +70,9 @@ /proc/log_pda(text) if (config.log_pda) - diary << "\[[time_stamp()]]PDA: [text]" \ No newline at end of file + diary << "\[[time_stamp()]]PDA: [text]" + +/proc/log_comment(text) + if (config.log_pda) + //reusing the PDA option because I really don't think news comments are worth a config option + diary << "\[[time_stamp()]]COMMENT: [text]" \ No newline at end of file diff --git a/code/game/machinery/newscaster.dm b/code/game/machinery/newscaster.dm index c30f006ee34..50caf7cea40 100644 --- a/code/game/machinery/newscaster.dm +++ b/code/game/machinery/newscaster.dm @@ -17,6 +17,7 @@ var/icon/img = null var/time_stamp = "" var/list/datum/feed_comment/comments = list() + var/locked = 0 /datum/feed_channel var/channel_name="" @@ -373,7 +374,10 @@ var/list/obj/machinery/newscaster/allCasters = list() //Global list that will co dat+="[MESSAGE.comments.len] comment[MESSAGE.comments.len > 1 ? "s" : ""]:
" for(var/datum/feed_comment/comment in MESSAGE.comments) dat+="[comment.body]
[comment.author] [comment.time_stamp]
" - dat+="Comment
" + if(MESSAGE.locked) + dat+="Comments locked
" + else + dat+="Comment
" dat+="

Refresh" dat+="
Back" if(10) @@ -410,6 +414,9 @@ var/list/obj/machinery/newscaster/allCasters = list() //Global list that will co for(var/datum/feed_message/MESSAGE in src.viewing_channel.messages) dat+="-[MESSAGE.body]
\[Story by [MESSAGE.author]\]
" dat+="[(MESSAGE.body == "\[REDACTED\]") ? ("Undo story censorship") : ("Censor story")] - [(MESSAGE.author == "\[REDACTED\]") ? ("Undo Author Censorship") : ("Censor message Author")]
" + dat+="[MESSAGE.comments.len] comment[MESSAGE.comments.len > 1 ? "s" : ""]: [MESSAGE.locked ? "Unlock" : "Lock"]
" + for(var/datum/feed_comment/comment in MESSAGE.comments) + dat+="[comment.body] X
[comment.author] [comment.time_stamp]
" dat+="
Back" if(13) dat+="[src.viewing_channel.channel_name]: \[ created by: [src.viewing_channel.author] \]
" @@ -747,6 +754,19 @@ var/list/obj/machinery/newscaster/allCasters = list() //Global list that will co FC.body = cominput FC.time_stamp = worldtime2text() FM.comments += FC + log_comment("[usr]/([usr.ckey]) as [scanned_user] commented on message [FM.body] -- [FC.body]") + updateUsrDialog() + + else if(href_list["del_comment"]) + var/datum/feed_comment/FC = locate(href_list["del_comment"]) + var/datum/feed_message/FM = locate(href_list["del_comment_msg"]) + FM.comments -= FC + qdel(FC) + updateUsrDialog() + + else if(href_list["lock_comment"]) + var/datum/feed_message/FM = locate(href_list["lock_comment"]) + FM.locked ^= 1 updateUsrDialog() else if(href_list["refresh"]) diff --git a/code/modules/admin/admin.dm b/code/modules/admin/admin.dm index 95ec12426c6..4fbd9fe533c 100644 --- a/code/modules/admin/admin.dm +++ b/code/modules/admin/admin.dm @@ -252,6 +252,10 @@ var/global/floorIsLava = 0 usr << browse_rsc(MESSAGE.img, "tmp_photo[i].png") dat+="

" dat+="\[Story by [MESSAGE.author]\]
" + dat+="[MESSAGE.comments.len] comment[MESSAGE.comments.len > 1 ? "s" : ""]:
" + for(var/datum/feed_comment/comment in MESSAGE.comments) + dat+="[comment.body]
[comment.author] [comment.time_stamp]
" + dat+="
" dat+="

Refresh" dat+="
Back" if(10) @@ -287,6 +291,9 @@ var/global/floorIsLava = 0 for(var/datum/feed_message/MESSAGE in src.admincaster_feed_channel.messages) dat+="-[MESSAGE.body]
\[Story by [MESSAGE.author]\]
" dat+="[(MESSAGE.body == "\[REDACTED\]") ? ("Undo story censorship") : ("Censor story")] - [(MESSAGE.author == "\[REDACTED\]") ? ("Undo Author Censorship") : ("Censor message Author")]
" + dat+="[MESSAGE.comments.len] comment[MESSAGE.comments.len > 1 ? "s" : ""]: [MESSAGE.locked ? "Unlock" : "Lock"]
" + for(var/datum/feed_comment/comment in MESSAGE.comments) + dat+="[comment.body] X
[comment.author] [comment.time_stamp]
" dat+="
Back" if(13) dat+="[src.admincaster_feed_channel.channel_name]: \[ created by: [src.admincaster_feed_channel.author] \]
" @@ -300,7 +307,6 @@ var/global/floorIsLava = 0 else for(var/datum/feed_message/MESSAGE in src.admincaster_feed_channel.messages) dat+="-[MESSAGE.body]
\[Story by [MESSAGE.author]\]
" - dat+="
Back" if(14) dat+="Wanted Issue Handler:" diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm index 767627aa68a..5c1d89c4642 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -2273,3 +2273,15 @@ else if(href_list["ac_set_signature"]) src.admincaster_signature = adminscrub(input(usr, "Provide your desired signature", "Network Identity Handler", "")) src.access_news_network() + + else if(href_list["ac_del_comment"]) + var/datum/feed_comment/FC = locate(href_list["ac_del_comment"]) + var/datum/feed_message/FM = locate(href_list["ac_del_comment_msg"]) + FM.comments -= FC + qdel(FC) + src.access_news_network() + + else if(href_list["ac_lock_comment"]) + var/datum/feed_message/FM = locate(href_list["ac_lock_comment"]) + FM.locked ^= 1 + src.access_news_network()