From 5cb0cb2b456acff9009d79a3a9586756d496186f Mon Sep 17 00:00:00 2001 From: Petr Bena Date: Tue, 25 Jun 2019 12:43:15 +0200 Subject: [PATCH] fixed https://phabricator.wikimedia.org/T218601 --- src/huggle_core/userconfiguration.cpp | 8 ++++++++ src/huggle_core/userconfiguration.hpp | 2 ++ src/huggle_ui/loginform.cpp | 2 ++ 3 files changed, 12 insertions(+) diff --git a/src/huggle_core/userconfiguration.cpp b/src/huggle_core/userconfiguration.cpp index c8538addf..1b3c9c9e0 100644 --- a/src/huggle_core/userconfiguration.cpp +++ b/src/huggle_core/userconfiguration.cpp @@ -96,6 +96,14 @@ Huggle::UserConfiguration::~UserConfiguration() } } +void UserConfiguration::SetDefaults(ProjectConfiguration *ProjectConfig) +{ + this->DefaultSummary = ProjectConfig->DefaultSummary; + this->RollbackSummary = ProjectConfig->RollbackSummary; + this->RollbackSummaryUnknownTarget = ProjectConfig->RollbackSummaryUnknownTarget; + this->WelcomeGood = ProjectConfig->WelcomeGood; +} + HuggleOption *UserConfiguration::GetOption(const QString& key) { if (this->UserOptions.contains(key)) diff --git a/src/huggle_core/userconfiguration.hpp b/src/huggle_core/userconfiguration.hpp index 4ce1e2054..d3af76cf8 100644 --- a/src/huggle_core/userconfiguration.hpp +++ b/src/huggle_core/userconfiguration.hpp @@ -59,6 +59,8 @@ namespace Huggle UserConfiguration(); ~UserConfiguration(); + //! In case there is no user config on wiki yet, Parse is not called at all so we need to initialize this user config with defaults from project + void SetDefaults(ProjectConfiguration *ProjectConfig); //! This function is obsolete and used only to read the old format huggle3.css file, new versions should only use YAML formats bool Parse(const QString& config, ProjectConfiguration *ProjectConfig, bool IsHome); bool ParseYAML(const QString &config, ProjectConfiguration *ProjectConfig, bool IsHome, QString *error); diff --git a/src/huggle_ui/loginform.cpp b/src/huggle_ui/loginform.cpp index bb1aa137d..29300d877 100644 --- a/src/huggle_ui/loginform.cpp +++ b/src/huggle_ui/loginform.cpp @@ -937,6 +937,8 @@ void LoginForm::retrieveUserConfig(WikiSite *site) q->DecRef(); this->LoginQueries.remove(site); this->Statuses[site] = RetrievingUser; + // initialize user config with default values taken from project + site->GetUserConfig()->SetDefaults(site->GetProjectConfig()); return; } HUGGLE_DEBUG1(q->Result->Data);