Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show latest updates after refresh #2552

Merged
merged 1 commit into from
Oct 31, 2018

Conversation

HebaruSan
Copy link
Member

Problem

After you click Refresh in GUI, the latest updates are downloaded from the repo, but only certain changes are reflected in the mod list:

  • Newly added mods
  • New versions
  • Installation status

But if other things change, this isn't shown in the mod list until you restart CKAN:

  • Game version compatibility
  • Display name or abstract
  • Author
  • Download size or count
  • Etc.

Cause

ConstructModList goes out of its way to cause this problem in order to avoid losing user changes. A refreshAll parameter is passed based on whether we're doing a repo update, in which case the previous GUIMod objects are mostly kept. This is kind of odd because a repo update is the only way that most of those properties can be changed.

CKAN/GUI/MainModList.cs

Lines 198 to 199 in b9a91fa

// Update our mod listing. If we're doing a repo update, then we don't refresh
// all (in case the user has selected changes they wish to apply).

/// <param name="refreshAll">If set to <c>true</c> then always rebuild the list from scratch</param>

CKAN/GUI/MainModList.cs

Lines 692 to 697 in b9a91fa

// We're only going to update the status of rows that either don't already exist,
// or which exist but have changed their latest version
// or whose installation status has changed
//
// TODO: Will this catch a mod where the latest version number remains the same, but
// another part of the metadata (eg: dependencies or description) has changed?

(The answer to that final question is, "No.")

Changes

Now the GUIMod objects built by UpdateModsList will have .IsInstallChecked and .IsUpgradeChecked set to match the change set parameter, and the Refresh button passes the current change set in that parameter. This ensures that the new GUIMod objects will not lose the change set when refreshing.

Then ConstructModList just unconditionally generates new rows for everything, since it can trust that their checkbox values are reflected in the GUIMod objects. The refreshAll parameter is removed as it is no longer needed.

Together, these changes mean that if you select several mods to install and click Refresh, then those same mods will still be checked afterwards, and all rows will show the latest info, even the ones you checked.

Fixes #1738.

@HebaruSan HebaruSan added GUI Issues affecting the interactive GUI Pull request labels Oct 24, 2018
@politas politas merged commit 01c9cf1 into KSP-CKAN:master Oct 31, 2018
politas added a commit that referenced this pull request Oct 31, 2018
@HebaruSan HebaruSan deleted the fix/update-after-refresh branch October 31, 2018 03:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GUI Issues affecting the interactive GUI Pull request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants