From 893b31e769a612fcc57d89be541c94044bd7f486 Mon Sep 17 00:00:00 2001 From: pentarctagon Date: Thu, 12 Dec 2024 15:06:37 -0600 Subject: [PATCH] return pbl author attribute to its original usage and use the new primary_authors attribute instead Fixes #9547 --- changelog_entries/primary_authors.md | 2 ++ data/gui/themes/default/window/editor_edit_pbl.cfg | 1 + data/schema/pbl.cfg | 1 + src/gui/dialogs/addon/addon_auth.cpp | 8 ++++++-- src/gui/dialogs/editor/edit_pbl.cpp | 14 ++++++++++++++ src/server/campaignd/server.cpp | 11 +++++++++-- src/server/common/forum_user_handler.cpp | 11 +++++++---- src/server/common/forum_user_handler.hpp | 4 ++-- src/server/common/user_handler.hpp | 2 +- 9 files changed, 43 insertions(+), 11 deletions(-) create mode 100644 changelog_entries/primary_authors.md diff --git a/changelog_entries/primary_authors.md b/changelog_entries/primary_authors.md new file mode 100644 index 00000000000..c492e3d3787 --- /dev/null +++ b/changelog_entries/primary_authors.md @@ -0,0 +1,2 @@ +### WML Engine + * The author attribute is now again a display only attribute. Instead the primary_authors attribute should be used, which supports specifying multiple primary authors. diff --git a/data/gui/themes/default/window/editor_edit_pbl.cfg b/data/gui/themes/default/window/editor_edit_pbl.cfg index 5e05577b2e0..a1e9440d0e9 100644 --- a/data/gui/themes/default/window/editor_edit_pbl.cfg +++ b/data/gui/themes/default/window/editor_edit_pbl.cfg @@ -211,6 +211,7 @@ {ROW text_box _"Forum thread:" "forum_thread" _"The numeric topic ID of a thread on the Wesnoth forums where players can post feedback."} {ROW label _"Forum URL" "forum_url" _"The full URL of your feedback thread on the forums."} {ROW toggle_button _"Forum Authentication:" "forum_auth" _"Whether to use your forum username and password when uploading or to store your password and email address in the add-on’s _server.pbl."} + {ROW text_box _"Primary Authors:" "primary_authors" _"Comma delimited list of forum usernames of other people who are allowed to upload updates for this add-on or delete this add-on."} {ROW text_box _"Secondary Authors:" "secondary_authors" _"Comma delimited list of forum usernames of other people who are allowed to upload updates for this add-on."} {ROW text_box _"Email:" "email" _"An email address you can be contacted at in case of issues with your add-on."} {ROW text_box _"Password:" "password" _"The add-on’s current password. Using forum authentication is recommended instead since this password is not stored securely."} diff --git a/data/schema/pbl.cfg b/data/schema/pbl.cfg index 2ad6a276ece..8b4201d8128 100644 --- a/data/schema/pbl.cfg +++ b/data/schema/pbl.cfg @@ -43,6 +43,7 @@ {SIMPLE_KEY email email} [/then] [else] + {SIMPLE_KEY primary_authors string_list} {SIMPLE_KEY secondary_authors string_list} [/else] [/if] diff --git a/src/gui/dialogs/addon/addon_auth.cpp b/src/gui/dialogs/addon/addon_auth.cpp index 9daea8723cc..da9a868dcee 100644 --- a/src/gui/dialogs/addon/addon_auth.cpp +++ b/src/gui/dialogs/addon/addon_auth.cpp @@ -45,12 +45,16 @@ void addon_auth::pre_show() pwd->set_value(cfg_["passphrase"].str("")); std::vector content_list; - content_list.emplace_back("label", cfg_["author"].str("")); + for(const auto& author : utils::split(cfg_["primary_authors"].str(""), ',')) { + content_list.emplace_back("label", author); + } for(const auto& author : utils::split(cfg_["secondary_authors"].str(""), ',')) { content_list.emplace_back("label", author); } - find_widget("choose_uploader").set_values(content_list); + if(content_list.size() > 0) { + find_widget("choose_uploader").set_values(content_list); + } } void addon_auth::post_show() diff --git a/src/gui/dialogs/editor/edit_pbl.cpp b/src/gui/dialogs/editor/edit_pbl.cpp index fef10e2fb68..9f58a234de4 100644 --- a/src/gui/dialogs/editor/edit_pbl.cpp +++ b/src/gui/dialogs/editor/edit_pbl.cpp @@ -140,15 +140,21 @@ void editor_edit_pbl::pre_show() if(pbl["forum_auth"].to_bool()) { find_widget("forum_auth").set_value(true); + find_widget("primary_authors").set_value(pbl["primary_authors"]); + find_widget("secondary_authors").set_value(pbl["secondary_authors"]); find_widget("email").set_visible(gui2::widget::visibility::invisible); find_widget