Skip to content

(#1137) Fix package gallery details url not showing on gallery packages#1138

Merged
vexx32 merged 5 commits into
chocolatey:developfrom
AdmiringWorm:map-package-gallery-details-url
May 22, 2026
Merged

(#1137) Fix package gallery details url not showing on gallery packages#1138
vexx32 merged 5 commits into
chocolatey:developfrom
AdmiringWorm:map-package-gallery-details-url

Conversation

@AdmiringWorm

Copy link
Copy Markdown
Member

Description Of Changes

  • Add unit test projects (ChocolateyGui.Tests, ChocolateyGui.Common.Tests, ChocolateyGui.Common.Windows.Tests) to solution with testing infrastructure
  • Map PackageDetailsUrl to GalleryDetailsUrl in AutoMapper profile with null handling
  • Introduce GalleryUriBuilder utility class for consistent gallery URI construction and source validation
  • Implement automatic gallery details URL generation for packages from known sources
  • Extract AutoMapper configuration into dedicated ChocolateyMapperConfiguration class for improved maintainability

Motivation and Context

Fix issue where Gallery URLs are not being visible despite them being available, as well as adding Gallery URLs for locally installed packages when the source is a known Gallery Source.

Testing

Before starting the testing step, ensure that you have at least 1 package installed from the Chocolatey Community Repository, one package from a non Chocolatey Community Repository source, as well as having the Chocolatey Community Repository source, and one non Chocolatey Community Repository source available and enabled.

  1. Navigate to the This PC sidebar menu.
  2. Double-click a package coming from the Chocolatey Community Repository source
  3. In the left side-bar at the bottom, ensure that a link to the Gallery is mentioned, and clicking on it navigates to the correct page.
  4. Navigate back to the This PC sidebar menu.
  5. Double-click a package coming from a custom source.
  6. In the left side-bar, ensure that there are no mentions of any links to the Gallery.
  7. Navigate to the chocolatey source.
  8. Once packages has been loaded, double click on any package on this feed (preferably not an installed package).
  9. In the left side-bar at the bottom, ensure that a link to the Gallery is mentioned, and clicking on it navigates to the correct page.
  10. Navigate to your custom source.
  11. Once packages has been loaded, double click on any package on this feed (preferably not an installed package).
  12. In the left side-bar, ensure that there are no mentions of any links to the Gallery.

To note: FlaUI tests were attempted, but due to them seeming to need a specific initial state were not possible to complete at this moment.

Operating Systems Testing

  • Windows 11

Change Types Made

  • Bug fix (non-breaking change).
  • Feature / Enhancement (non-breaking change).
  • Breaking change (fix or feature that could cause existing functionality to change).
  • Documentation changes.
  • PowerShell code changes.

Change Checklist

  • Requires a change to the documentation.
  • Documentation has been updated.
  • Tests to cover my changes, have been added. (Some of them)
  • All new and existing tests passed?
  • PowerShell code changes: PowerShell v3 compatibility checked?
  • All items are complete on the Definition of Done.

Related Issue

Fixes #1137

Add three new unit test projects to the solution structure and
configure the UITests project with necessary testing dependencies.
This establishes a comprehensive testing framework across multiple
project layers.

Key Changes:
- Add ChocolateyGui.Tests project
- Add ChocolateyGui.Common.Tests project
- Add ChocolateyGui.Common.Windows.Tests project
- Create Tests solution folder to organize test projects
- Add coverlet.msbuild package for code coverage support
- Add Microsoft.NET.Test.Sdk package to UITests project
- Configure all test projects with build configurations

Reason for the change:
- Improve test coverage across the codebase
- Establish unit testing infrastructure for core components
- Enable code coverage analysis and reporting
- Organize test projects in a dedicated solution folder
Add mapping configuration for the GalleryDetailsUrl property in the
AutoMapper profile for package metadata transformation.

Key Changes:
- Add ForMember mapping for GalleryDetailsUrl property
- Map PackageDetailsUrl to GalleryDetailsUrl with null handling
- Convert PackageDetailsUrl to its absolute URI string representation

Reason of the change:
- Ensure package gallery URL is properly mapped during object
  transformation
- Handle null PackageDetailsUrl values gracefully to prevent mapping
  errors
- Provide consistent access to package details URL through the mapped
  GalleryDetailsUrl property
@AdmiringWorm AdmiringWorm requested a review from a team as a code owner May 21, 2026 10:17
@AdmiringWorm AdmiringWorm requested review from gep13 and vexx32 May 21, 2026 10:17

@vexx32 vexx32 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly looks good, a couple things I think we can improve, but nothing major.

Comment thread Source/ChocolateyGui.Common.Windows/Startup/ChocolateyGuiMapper.cs
Comment thread Source/ChocolateyGui.Common.Windows/Startup/ChocolateyMapperConfiguration.cs Outdated
Introduce a new utility class to handle gallery URI construction
and validation for Chocolatey package sources. This centralizes
the logic for building package gallery URLs and identifying known
Chocolatey sources.

Key Changes:
- Add GalleryUriBuilder static class with URI construction methods
- Implement BuildFromPackageAndSource to create URIs from package
  ID, source URL, and optional version
- Implement BuildCommunityGalleryFromPackage for community gallery
  URIs
- Implement IsKnownSource to validate if a URL is a known
  Chocolatey source

Reason for the change:
- Consolidate URI building logic in a reusable utility class
- Reduce code duplication across the application
- Provide consistent handling of gallery URLs and source validation
Enhance package mapping to automatically generate gallery details URLs
for known package sources when the URL is not already set.

Key Changes:
- Add using statement for ChocolateyGui.Common.Windows.Utilities
- Implement logic to build gallery details URL from package source
  information
- Use GalleryUriBuilder to construct URLs for known sources
- Populate mappedPackage.GalleryDetailsUrl when empty and source is
  recognized

Reason of the change:
- Improve user experience by automatically providing gallery links for
  packages from known sources (normally locally installed packages)
- Reduce manual URL configuration requirements
- Leverage existing GalleryUriBuilder utility for consistent URL
  generation
Move AutoMapper configuration logic from ChocolateyGuiModule
into a dedicated ChocolateyMapperConfiguration class. This
improves code organization and makes the mapper setup more
testable and maintainable.

Key Changes:
- Create new ChocolateyMapperConfiguration class with
  CreateConfiguration method
- Move all mapper configuration code from ChocolateyGuiModule
  to the new class
- Remove unused imports from ChocolateyGuiModule
- Configure all entity mappings including Package, Feature,
  Setting, Source, and AdvancedInstall types

Reason for the change:
- Reduce complexity in ChocolateyGuiModule by extracting
  mapper setup logic
- Improve testability of mapper configuration
- Follow single responsibility principle
- Make mapper configuration reusable across the application
@AdmiringWorm AdmiringWorm force-pushed the map-package-gallery-details-url branch from de3332c to 5a9465c Compare May 22, 2026 12:20
@AdmiringWorm AdmiringWorm requested a review from vexx32 May 22, 2026 12:20

@vexx32 vexx32 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, great work!

@vexx32 vexx32 merged commit af3a5ef into chocolatey:develop May 22, 2026
2 checks passed
@AdmiringWorm AdmiringWorm deleted the map-package-gallery-details-url branch May 22, 2026 19:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Gallery URL not available for packages on the Chocolatey Community Repository

2 participants