Skip to content

Commit

Permalink
Fixed issue with duplicate packages showing up. Allow MiniProfiler to…
Browse files Browse the repository at this point in the history
… be displayed on staging. Fixed broken modernizr script
  • Loading branch information
pranavkm committed Oct 26, 2011
1 parent 04b63ef commit 96fa2ff
Show file tree
Hide file tree
Showing 6 changed files with 646 additions and 626 deletions.
5 changes: 3 additions & 2 deletions Website/App_Start/MiniProfiler.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System;
using System.Configuration;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
Expand Down Expand Up @@ -60,9 +61,9 @@ public void Init(HttpApplication context)
{
var userCanProfile = httpContext.User != null && HttpContext.Current.User.IsInRole(Const.AdminRoleName);
var requestIsLocal = httpContext.Request != null && httpContext.Request.IsLocal;
var isStaging = httpContext.Request != null && httpContext.Request.Url.Host.Equals("staging.nuget.org", StringComparison.OrdinalIgnoreCase);

if (!userCanProfile && !requestIsLocal)
stopProfiling = true;
stopProfiling = !userCanProfile && !requestIsLocal && !isStaging;
}

if (stopProfiling)
Expand Down
4 changes: 2 additions & 2 deletions Website/Services/PackageService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ public IQueryable<Package> GetLatestPackageVersions(bool allowPrerelease)

if (allowPrerelease)
{
// Since we use this for listing, when we allow pre release versions, we'll assume they meant to show both the latest release and prerelease versions of a package.
return packages.Where(p => p.IsLatest || p.IsLatestStable);
// Since we use this for listing, only show prerelease versions of a package if it does not have stable version
return packages.Where(p => p.IsLatestStable || (p.IsLatest && !packages.Any(p2 => p2.IsLatestStable)));
}
return packages.Where(x => x.IsLatestStable);
}
Expand Down
10 changes: 8 additions & 2 deletions Website/Views/Packages/DisplayPackage.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
This is a prerelease version of @Model.Title.
</p>
}
else if (!Model.LatestVersion) {
else if (!Model.LatestStableVersion && !Model.LatestVersion) {
<p class="not-latest-message">
This is a not the <a href="@Url.Package(Model.Id)" title="View the latest version">latest
version</a> of @Model.Title.
Expand All @@ -74,7 +74,13 @@
<div class="nuget-badge">
<p>
<code>PM&gt; Install-Package @Model.Id
@if (!Model.LatestVersion) {<text> -Version @Model.Version</text>}
@if (!Model.LatestStableVersion)
{
if (Model.LatestVersion)
{ <text> -Pre </text> }
else
{ <text> -Version @Model.Version</text> }
}
@if (Model.Prerelease) {<text> -pre </text>}</code></p>
</div>

Expand Down
Loading

0 comments on commit 96fa2ff

Please sign in to comment.