Install old versions of mods on double click from version list #2364
+88
−52
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Background
Currently GUI can only install the latest compatible version of a given mod. So while there may be versions 1.0, 1.1, 1.2, and 1.3 of a mod in the registry, you can only install 1.3.
It may be desirable to install older versions of a mod in some cases. For example, I need to do this to investigate a bug report involving upgrades; if I can only install the latest versions, then I would have to install a bunch of mods and then wait for one of them to upgrade, and repeating such a test would involve more waiting. (Yes, there's a way to do it in Cmdline, but it's nice to have in GUI as well.)
There's a Versions tab that lists all versions of the mod and indicates which are compatible with the current game version. It's not interactive at the moment.
Changes
Now if you double click one of the green versions, CKAN prompts you to confirm that you want to install it:
If you click yes, then off to the install flow you go:
And when it finishes, the mod appears as installed and upgradeable in the mod list, as expected:
From a code perspective, the "import from .ckan file" code is refactored to a standalone function in MainInstall.cs, which is now shared with the newly added double click handler for the versions list view. To get the
CkanModule
from the list view, we now set them into the.Tag
properties of the list view items.Fixes #2077.