Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
benapetr committed Jun 25, 2019
1 parent a262448 commit 5cb0cb2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/huggle_core/userconfiguration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
2 changes: 2 additions & 0 deletions src/huggle_core/userconfiguration.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions src/huggle_ui/loginform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 5cb0cb2

Please sign in to comment.