Permalink
Browse files

changed rollback token processing

so we are more resistant to mediawiki fuckups
  • Loading branch information...
benapetr committed Nov 5, 2014
1 parent 1b83a15 commit 83e6ef2dd62f31e233aa6cae13b1482a7cdf318f
Showing with 11 additions and 7 deletions.
  1. +8 −2 huggle/mainwindow.cpp
  2. +2 −1 huggle/revertquery.cpp
  3. +1 −4 huggle/wikiedit.cpp
View
@@ -910,8 +910,14 @@ Collectable_SmartPtr<RevertQuery> MainWindow::Revert(QString summary, bool next,
}
if (this->CurrentEdit->RollbackToken.isEmpty())
{
Syslog::HuggleLogs->WarningLog(_l("main-revert-manual", this->CurrentEdit->Page->PageName));
rollback = false;
if (!this->CurrentEdit->GetSite()->GetProjectConfig()->RollbackToken.isEmpty())
{
this->CurrentEdit->RollbackToken = this->CurrentEdit->GetSite()->GetProjectConfig()->RollbackToken;
} else
{
Syslog::HuggleLogs->WarningLog(_l("main-revert-manual", this->CurrentEdit->Page->PageName));
rollback = false;
}
}
if (this->PreflightCheck(this->CurrentEdit))
{
View
@@ -191,8 +191,9 @@ QString RevertQuery::GetCustomRevertStatus(QueryResult *result_data, WikiSite *s
return "ERROR: Cannot rollback - page only has one author";
if (Error == "badtoken")
{
QString msg = "ERROR: Cannot rollback, token " + site->GetProjectConfig()->RollbackToken + " is not valid for some reason (mediawiki bug), please try it once more";
site->GetProjectConfig()->RollbackToken.clear();
return "ERROR: Cannot rollback, token is not valid, please try it once more";
return msg;
}
return "In error (" + Error +")";
}
View
@@ -241,9 +241,6 @@ bool WikiEdit::FinalizePostProcessing()
return true;
}
if (!this->GetSite()->GetProjectConfig()->RollbackToken.isEmpty())
this->RollbackToken = this->GetSite()->GetProjectConfig()->RollbackToken;
// parse the diff now
QDomDocument d;
d.setContent(this->qDifference->Result->Data);
@@ -262,7 +259,7 @@ bool WikiEdit::FinalizePostProcessing()
{
if (e.attribute("user") == this->User->Username)
{
if (this->RollbackToken.isEmpty() && e.attributes().contains("rollbacktoken"))
if (this->GetSite()->GetProjectConfig()->RollbackToken.isEmpty() && this->RollbackToken.isEmpty() && e.attributes().contains("rollbacktoken"))
{
// let's update it from fresh diff
this->RollbackToken = e.attribute("rollbacktoken");

0 comments on commit 83e6ef2

Please sign in to comment.