From bb697fd1ee79cd2a3718055b252bffacc4ce6636 Mon Sep 17 00:00:00 2001 From: AffectedArc07 Date: Mon, 18 May 2020 09:55:57 +0100 Subject: [PATCH] CL Fixes Round 1 --- code/controllers/subsystem/changelog.dm | 55 ++++++++++++++++++++----- 1 file changed, 44 insertions(+), 11 deletions(-) diff --git a/code/controllers/subsystem/changelog.dm b/code/controllers/subsystem/changelog.dm index 4c32285471d..98188599abd 100644 --- a/code/controllers/subsystem/changelog.dm +++ b/code/controllers/subsystem/changelog.dm @@ -89,15 +89,17 @@ SUBSYSTEM_DEF(changelog) winset(C, "rpane.changelog", "background-color=none;text-color=#000000") return - // If we are ready, process the button style - if(C.prefs.lastchangelog != current_cl_timestamp) - winset(C, "rpane.changelog", "background-color=#bb7700;text-color=#FFFFFF;font-style=bold") - to_chat(C, "Changelog has changed since your last visit.") - else - if(C.prefs.toggles & UI_DARKMODE) - winset(C, "rpane.changelog", "background-color=#40628a;text-color=#FFFFFF") + // Sanity check to ensure clients still exist (If a client DCs mid startup this would runtime) + if(C && C.prefs) + // If we are ready, process the button style + if(C.prefs.lastchangelog != current_cl_timestamp) + winset(C, "rpane.changelog", "background-color=#bb7700;text-color=#FFFFFF;font-style=bold") + to_chat(C, "Changelog has changed since your last visit.") else - winset(C, "rpane.changelog", "background-color=none;text-color=#000000") + if(C.prefs.toggles & UI_DARKMODE) + winset(C, "rpane.changelog", "background-color=#40628a;text-color=#FFFFFF") + else + winset(C, "rpane.changelog", "background-color=none;text-color=#000000") /datum/controller/subsystem/changelog/proc/OpenChangelog(client/C) @@ -162,11 +164,10 @@ SUBSYSTEM_DEF(changelog) var/changelog_header = {" ParadiseSS13 Changelog -

Paradise Station Changelog

-

Forum - Wiki - GitHub

+

Forum - Wiki - GitHub

"} @@ -217,7 +218,7 @@ SUBSYSTEM_DEF(changelog) // Now we make a changelog block pr_block += "
" // If the github URL in the config has a trailing slash, it doesnt matter here, thankfully github accepts having a double slash: https://github.com/org/repo//pull/1 - pr_block += "

#[pr_number] by [author] (Merged on [merge_date])" + pr_block += "

#[pr_number] by [author] (Merged on [merge_date])" while(db_entries.NextRow()) pr_block += "

[Text2Icon(db_entries.item[1])] [db_entries.item[2]]

" @@ -228,3 +229,35 @@ SUBSYSTEM_DEF(changelog) // Make sure we return TRUE so we know it worked return TRUE + + +// Topic handler so that PRs and forums and stuff open in another window +/datum/controller/subsystem/changelog/Topic(href, href_list) + // Handler to open pages in your browser instead of inside the CL window + // Yes usr.client is gross here but src is the subsystem + // Takes the page to open as an argument + if(href_list["openPage"]) + switch(href_list["openPage"]) + if("forum") + usr.client.forum() + if("wiki") + // Wiki needs snowflake because it has no cancel button + if(config.wikiurl) + if(alert("This will open the wiki in your browser. Are you sure?",,"Yes","No")=="No") + return + usr.client.wiki("") // Blank arg is important here + else + to_chat(usr, "The Wiki URL is not set in the server configuration. Please inform the server host.") + + if("github") + usr.client.github() + // Takes a PR number as argument + if(href_list["openPR"]) + if(config.githuburl) + if(alert("This will open PR #[href_list["openPR"]] in your browser. Are you sure?",,"Yes","No")=="No") + return + var/url = "[config.githuburl]/pull/[href_list["openPR"]]" + usr << link(url) + else + to_chat(usr, "The GitHub URL is not set in the server configuration. PRs cannot be opened from changelog view. Please inform the server host.") +