From cfdc533117e202b47e1d2e1cb6209fabf2fcaa08 Mon Sep 17 00:00:00 2001 From: Sierra Helper <125094432+SierraHelper@users.noreply.github.com> Date: Sun, 24 Nov 2024 06:31:29 +0300 Subject: [PATCH] [MIRROR] Fix newscaster images not appearing if channel contains symbols (#2771) Co-authored-by: HeyBanditoz <7574664+HeyBanditoz@users.noreply.github.com> Co-authored-by: Lexanx <61974560+Lexanx@users.noreply.github.com> --- code/game/machinery/newscaster.dm | 8 +++++--- html/changelogs/HeyBanditoz-fix-newscaster-images.yml | 4 ++++ 2 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 html/changelogs/HeyBanditoz-fix-newscaster-images.yml diff --git a/code/game/machinery/newscaster.dm b/code/game/machinery/newscaster.dm index 030905865aacd..fb60303f3f124 100644 --- a/code/game/machinery/newscaster.dm +++ b/code/game/machinery/newscaster.dm @@ -18,6 +18,7 @@ /datum/feed_channel var/channel_name="" + var/channel_id=0 var/list/datum/feed_message/messages = list() var/locked=0 var/author="" @@ -67,6 +68,7 @@ /datum/feed_network/proc/CreateFeedChannel(channel_name, author, locked, adminChannel = 0, announcement_message) var/datum/feed_channel/newChannel = new /datum/feed_channel newChannel.channel_name = channel_name + newChannel.channel_id = length(network_channels) newChannel.author = author newChannel.locked = locked newChannel.is_admin_channel = adminChannel @@ -95,7 +97,7 @@ /datum/feed_network/proc/insert_message_in_channel(datum/feed_channel/FC, datum/feed_message/newMsg) FC.messages += newMsg if(newMsg.img) - register_asset("newscaster_photo_[sanitize(FC.channel_name)]_[length(FC.messages)].png", newMsg.img) + register_asset("newscaster_photo_[FC.channel_id]_[length(FC.messages)].png", newMsg.img) newMsg.parent_channel = FC FC.update() alert_readers(FC.announcement) @@ -354,7 +356,7 @@ var/global/list/obj/machinery/newscaster/allCasters = list() //Global list that ++i dat+="-[MESSAGE.body]
" if(MESSAGE.img) - var/resourc_name = "newscaster_photo_[sanitize(viewing_channel.channel_name)]_[i].png" + var/resourc_name = "newscaster_photo_[viewing_channel.channel_id]_[i].png" send_asset(usr.client, resourc_name) dat+="
" if(MESSAGE.caption) @@ -841,7 +843,7 @@ var/global/list/obj/machinery/newscaster/allCasters = list() //Global list that ++i dat+="-[MESSAGE.body]
" if(MESSAGE.img) - var/resourc_name = "newscaster_photo_[sanitize(C.channel_name)]_[i].png" + var/resourc_name = "newscaster_photo_[C.channel_id]_[i].png" send_asset(user.client, resourc_name) dat+="
" dat+="[FONT_SMALL("\[[MESSAGE.message_type] by [SPAN_COLOR("maroon", MESSAGE.author)]\]")]

" diff --git a/html/changelogs/HeyBanditoz-fix-newscaster-images.yml b/html/changelogs/HeyBanditoz-fix-newscaster-images.yml new file mode 100644 index 0000000000000..6ab7712693863 --- /dev/null +++ b/html/changelogs/HeyBanditoz-fix-newscaster-images.yml @@ -0,0 +1,4 @@ +author: Banditoz +delete-after: True +changes: + - bugfix: "Fixed images in newscaster articles not showing up if the channel has special symbols in its title."