Skip to content

Conversation

cotti
Copy link
Contributor

@cotti cotti commented Oct 18, 2025

Closes #2018

Improves inference of the versioning system in situations where pages have no legacy URL mappings, or have different repository names from their current reference designation.

var currentBaseVersion = legacyPages is { Count: > 0 }
? $"{legacyPages.ElementAt(0).Product.VersioningSystem?.Base.Major}.{legacyPages.ElementAt(0).Product.VersioningSystem?.Base.Minor}+"
: $"{DocumentationSet.Context.VersionsConfiguration.VersioningSystems[VersioningSystemId.Stack].Base.Major}.{DocumentationSet.Context.VersionsConfiguration.VersioningSystems[VersioningSystemId.Stack].Base.Minor}+";
// Acquiring the versioning system for the current page:
Copy link
Member

Choose a reason for hiding this comment

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

Move this to an isolated place like LegacyPageService or something new

VersioningSystem pageVersioning = null!;
if (legacyPages is not null && legacyPages.Count > 0)
pageVersioning = legacyPages.ElementAt(0).Product.VersioningSystem!;
else if (DocumentationSet.Context.ProductsConfiguration.Products.TryGetValue(DocumentationSet.Name, out var belonging))
Copy link
Member

Choose a reason for hiding this comment

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

Lets use Git.RepositoryName explicitly over DocumentationSet.Name

pageVersioning = legacyPages.ElementAt(0).Product.VersioningSystem!;
else if (DocumentationSet.Context.ProductsConfiguration.Products.TryGetValue(DocumentationSet.Name, out var belonging))
pageVersioning = belonging.VersioningSystem!;
else if (DocumentationSet.Configuration.TableOfContents.FirstOrDefault(t => t is TocReference tRef && !tRef.Source.LocalPath.Equals("/")) is TocReference tocRef)
Copy link
Member

Choose a reason for hiding this comment

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

This is clever I wonder if its too clever though? What are the cases where this is needed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

EDOT SDK version dropdown not showing the right version

2 participants