Skip to content

Commit

Permalink
few comments related to userlistsync
Browse files Browse the repository at this point in the history
  • Loading branch information
benapetr committed Nov 5, 2024
1 parent 573bab7 commit 2312b0a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 6 additions & 0 deletions src/huggle_core/projectconfiguration.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,14 @@ namespace Huggle
bool ReadOnly = false;
bool IsSane = false;
bool Approval = false;

//! Whether each user should be added to ApprovalPage on login, this is an ancient feature that exists since
//! first version of Huggle and was probably historically mandatory on English Wikipedia.
//! This option can be disabled in project configuration page (option userlistsync)
bool UserlistSync = false;
//! Edit summary used when updating the Approval Page, this option exists mostly for localization purposes
QString UserlistUpdateSummary = "Adding [[Special:Contributions/$1|$1]]";
//! Name of page where users are stored in case UserlistSync is required
QString ApprovalPage = "Project:Huggle/Users";
QString ProjectName;
WikiSite *Site = nullptr;
Expand Down
7 changes: 4 additions & 3 deletions src/huggle_ui/loginform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1007,7 +1007,8 @@ void LoginForm::retrieveUserInfo(WikiSite *site)
}
QStringList users = result.toLower().split("\n");
QStringList sanitized;
// sanitize user list
// sanitize user list by making everything lower case and absent of underscore,
// this way we avoid inserting duplicities that only differ in case
foreach(QString user, users)
{
user = user.replace("_", " ");
Expand All @@ -1027,8 +1028,8 @@ void LoginForm::retrieveUserInfo(WikiSite *site)
if (site->GetProjectConfig()->UserlistSync)
{
// we need to insert this user into the list
QString un = WikiUtil::SanitizeUser(hcfg->SystemConfig_UserName);
QString line = "* [[Special:Contributions/" + un + "|" + un + "]]";
QString user_name = WikiUtil::SanitizeUser(hcfg->SystemConfig_UserName);
QString line = "* [[Special:Contributions/" + user_name + "|" + user_name + "]]";
result += "\n" + line;
QString summary = site->GetProjectConfig()->UserlistUpdateSummary;
summary.replace("$1", hcfg->SystemConfig_UserName);
Expand Down

0 comments on commit 2312b0a

Please sign in to comment.