From b4a9dd410c44e99dd1eb6775deea50f042899e15 Mon Sep 17 00:00:00 2001 From: Silarn Date: Sun, 27 Jan 2019 23:04:58 -0600 Subject: Fix issue with endorsement response parsing --- src/mainwindow.cpp | 20 +++++++++----------- src/modinforegular.cpp | 20 +++++++++----------- 2 files changed, 18 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index c2b61614..f875c95c 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -5569,17 +5569,15 @@ void MainWindow::nxmDescriptionAvailable(QString gameName, int modID, QVariant u void MainWindow::nxmEndorsementToggled(QString, int, QVariant, QVariant resultData, int) { QMap results = resultData.toMap(); - if (results["code"].toInt() == 200 || results["code"].toInt() == 201) { - if (results["status"].toString().compare("Endorsed") == 0) { - QMessageBox::information(this, tr("Thank you!"), tr("Thank you for your endorsement!")); - } else if (results["status"].toString().compare("Abstained") == 0) { - QMessageBox::information(this, tr("Okay."), tr("This mod will not be endorsed and will no longer ask you to endorse.")); - } - ui->actionEndorseMO->setVisible(false); - if (!disconnect(sender(), SIGNAL(nxmEndorsementToggled(QString, int, QVariant, QVariant, int)), - this, SLOT(nxmEndorsementToggled(QString, int, QVariant, QVariant, int)))) { - qCritical("failed to disconnect endorsement slot"); - } + if (results["status"].toString().compare("Endorsed") == 0) { + QMessageBox::information(this, tr("Thank you!"), tr("Thank you for your endorsement!")); + } else if (results["status"].toString().compare("Abstained") == 0) { + QMessageBox::information(this, tr("Okay."), tr("This mod will not be endorsed and will no longer ask you to endorse.")); + } + ui->actionEndorseMO->setVisible(false); + if (!disconnect(sender(), SIGNAL(nxmEndorsementToggled(QString, int, QVariant, QVariant, int)), + this, SLOT(nxmEndorsementToggled(QString, int, QVariant, QVariant, int)))) { + qCritical("failed to disconnect endorsement slot"); } } diff --git a/src/modinforegular.cpp b/src/modinforegular.cpp index 606924e4..834c09ae 100644 --- a/src/modinforegular.cpp +++ b/src/modinforegular.cpp @@ -235,18 +235,16 @@ void ModInfoRegular::nxmDescriptionAvailable(QString, int, QVariant, QVariant re void ModInfoRegular::nxmEndorsementToggled(QString, int, QVariant, QVariant resultData) { QMap results = resultData.toMap(); - if (results["code"].toInt() == 200 || results["code"].toInt() == 201) { - if (results["status"].toString().compare("Endorsed") == 0) { - m_EndorsedState = ENDORSED_TRUE; - } else if (results["status"].toString().compare("Abstained") == 0) { - m_EndorsedState = ENDORSED_NEVER; - } else { - m_EndorsedState = ENDORSED_FALSE; - } - m_MetaInfoChanged = true; - saveMeta(); - emit modDetailsUpdated(true); + if (results["status"].toString().compare("Endorsed") == 0) { + m_EndorsedState = ENDORSED_TRUE; + } else if (results["status"].toString().compare("Abstained") == 0) { + m_EndorsedState = ENDORSED_NEVER; + } else { + m_EndorsedState = ENDORSED_FALSE; } + m_MetaInfoChanged = true; + saveMeta(); + emit modDetailsUpdated(true); } -- cgit v1.3.1