Merge pull request #2173 from Trial97/dependency_removal

Remove dependencies if review mods is rejected
This commit is contained in:
Alexandru Ionut Tripon 2024-06-30 22:21:38 +03:00 committed by GitHub
commit 7ff173d72a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -145,6 +145,7 @@ void ResourceDownloadDialog::confirm()
confirm_dialog->retranslateUi(resourcesString());
QHash<QString, GetModDependenciesTask::PackDependencyExtraInfo> dependencyExtraInfo;
QStringList depNames;
if (auto task = getModDependenciesTask(); task) {
connect(task.get(), &Task::failed, this,
[&](QString reason) { CustomMessageBox::selectable(this, tr("Error"), reason, QMessageBox::Critical)->exec(); });
@ -167,8 +168,10 @@ void ResourceDownloadDialog::confirm()
QMetaObject::invokeMethod(this, "reject", Qt::QueuedConnection);
return;
} else {
for (auto dep : task->getDependecies())
for (auto dep : task->getDependecies()) {
addResource(dep->pack, dep->version);
depNames << dep->pack->name;
}
dependencyExtraInfo = task->getExtraInfo();
}
}
@ -193,6 +196,9 @@ void ResourceDownloadDialog::confirm()
}
this->accept();
} else {
for (auto name : depNames)
removeResource(name);
}
}