Skip to content

Commit

Permalink
Merge branch 'dev' into master (#6266)
Browse files Browse the repository at this point in the history
Related to #6230
  • Loading branch information
joelverhagen committed Aug 8, 2018
2 parents 7f6ba83 + f1737fc commit 760a814
Show file tree
Hide file tree
Showing 103 changed files with 4,167 additions and 1,248 deletions.
15 changes: 15 additions & 0 deletions src/Bootstrap/dist/css/bootstrap-theme.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/Bootstrap/less/theme/page-account-settings.less
Expand Up @@ -49,4 +49,9 @@
display: inline-block;
width: 100%;
}

.expired-certificate {
color: @state-danger-text;
font-weight: bold;
}
}
7 changes: 7 additions & 0 deletions src/Bootstrap/less/theme/page-display-package.less
Expand Up @@ -44,6 +44,13 @@
li {
margin-bottom: 15px;
}
img.icon {
position: absolute;
left: -24px;
width: 16px;
height: 16px;
margin-top: 3px;
}
}
}

Expand Down
7 changes: 6 additions & 1 deletion src/Bootstrap/less/theme/page-manage-packages.less
Expand Up @@ -44,7 +44,7 @@
.panel {
margin-top: 5px;
}

.manage-package-listing {
.ms-Icon {
position: relative;
Expand All @@ -55,4 +55,9 @@
.inner-table {
margin-bottom: 0px;
}

.required-signer {
width: 100%;
max-width: 90%;
}
}
1 change: 1 addition & 0 deletions src/NuGetGallery.Core/Entities/IEntitiesContext.cs
Expand Up @@ -18,6 +18,7 @@ public interface IEntitiesContext
IDbSet<UserSecurityPolicy> UserSecurityPolicies { get; set; }
IDbSet<ReservedNamespace> ReservedNamespaces { get; set; }
IDbSet<UserCertificate> UserCertificates { get; set; }
IDbSet<SymbolPackage> SymbolPackages { get; set; }

Task<int> SaveChangesAsync();
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Set", Justification="This is to match the EF terminology.")]
Expand Down
8 changes: 8 additions & 0 deletions src/NuGetGallery.Core/Entities/Package.cs
Expand Up @@ -21,6 +21,7 @@ public Package()
PackageHistories = new HashSet<PackageHistory>();
PackageTypes = new HashSet<PackageType>();
SupportedFrameworks = new HashSet<PackageFramework>();
SymbolPackages = new HashSet<SymbolPackage>();
Listed = true;
}
#pragma warning restore 618
Expand Down Expand Up @@ -123,6 +124,13 @@ public Package()
/// </remarks>
public string RepositoryUrl { get; set; }


/// <remarks>
/// Has a max length of 100. Is not indexed and not used for searches. Db column is nvarchar(100).
/// </remarks>
[StringLength(100)]
public string RepositoryType { get; set; }

/// <summary>
/// Nullable flag stored in the database. Callers should use the HasReadMe property instead.
/// </summary>
Expand Down
49 changes: 47 additions & 2 deletions src/NuGetGallery.Core/Entities/SymbolPackage.cs
Expand Up @@ -8,7 +8,7 @@
namespace NuGetGallery
{
public class SymbolPackage
: IEntity
: IEntity, IEquatable<SymbolPackage>
{
public int Key { get; set; }

Expand All @@ -19,7 +19,6 @@ public class SymbolPackage
/// <summary>
/// Timestamp when this symbol was created.
/// </summary>
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
public DateTime Created { get; set; }

/// <summary>
Expand Down Expand Up @@ -51,5 +50,51 @@ public class SymbolPackage
/// Used for optimistic concurrency when updating the symbols.
/// </summary>
public byte[] RowVersion { get; set; }

public bool Equals(SymbolPackage other)
{
return other.Key == Key;
}

public override int GetHashCode()
{
return Key.GetHashCode();
}

public override bool Equals(object obj)
{
if (obj == null)
{
return false;
}

SymbolPackage sp = obj as SymbolPackage;
if (sp == null)
{
return false;
}

return Equals(sp);
}

public static bool operator ==(SymbolPackage sp1, SymbolPackage sp2)
{
if (((object)sp1) == null || ((object)sp2) == null)
{
return Equals(sp1, sp2);
}

return sp1.Equals(sp2);
}

public static bool operator !=(SymbolPackage sp1, SymbolPackage sp2)
{
if (((object)sp1) == null || ((object)sp2) == null)
{
return !Equals(sp1, sp2);
}

return !sp1.Equals(sp2);
}
}
}
20 changes: 15 additions & 5 deletions src/NuGetGallery.Core/Packaging/PackageMetadata.cs
Expand Up @@ -50,7 +50,8 @@ public class PackageMetadata
IEnumerable<PackageDependencyGroup> dependencyGroups,
IEnumerable<FrameworkSpecificGroup> frameworkGroups,
IEnumerable<NuGet.Packaging.Core.PackageType> packageTypes,
NuGetVersion minClientVersion)
NuGetVersion minClientVersion,
RepositoryMetadata repositoryMetadata)
{
_metadata = new Dictionary<string, string>(metadata, StringComparer.OrdinalIgnoreCase);
_dependencyGroups = dependencyGroups.ToList().AsReadOnly();
Expand All @@ -59,6 +60,13 @@ public class PackageMetadata

SetPropertiesFromMetadata();
MinClientVersion = minClientVersion;

if (repositoryMetadata != null)
{
Uri.TryCreate(repositoryMetadata.Url, UriKind.Absolute, out var repoUrl);
RepositoryUrl = repoUrl;
RepositoryType = repositoryMetadata.Type;
}
}

private void SetPropertiesFromMetadata()
Expand Down Expand Up @@ -100,6 +108,8 @@ private void SetPropertiesFromMetadata()

public Uri IconUrl { get; private set; }
public Uri ProjectUrl { get; private set; }
public Uri RepositoryUrl { get; private set; }
public string RepositoryType { get; private set; }
public Uri LicenseUrl { get; private set; }
public string Copyright { get; private set; }
public string Description { get; private set; }
Expand Down Expand Up @@ -180,7 +190,7 @@ private Uri GetValue(string key, Uri alternateValue)
/// Whether or not to be strict when reading the <see cref="NuspecReader"/>. This should be <code>true</code>
/// on initial ingestion but false when a package that has already been accepted is being processed.</param>
/// <exception cref="PackagingException">
/// We default to use a strict version-check on dependency groups.
/// We default to use a strict version-check on dependency groups.
/// When an invalid dependency version range is detected, a <see cref="PackagingException"/> will be thrown.
/// </exception>
public static PackageMetadata FromNuspecReader(NuspecReader nuspecReader, bool strict)
Expand Down Expand Up @@ -233,8 +243,8 @@ public static PackageMetadata FromNuspecReader(NuspecReader nuspecReader, bool s
nuspecReader.GetDependencyGroups(useStrictVersionCheck: strict),
nuspecReader.GetFrameworkReferenceGroups(),
nuspecReader.GetPackageTypes(),
nuspecReader.GetMinClientVersion()
);
nuspecReader.GetMinClientVersion(),
nuspecReader.GetRepositoryMetadata());
}

private class StrictNuspecReader : NuspecReader
Expand All @@ -251,4 +261,4 @@ public StrictNuspecReader(XDocument xml) : base(xml)
}
}
}
}
}
Expand Up @@ -30,7 +30,9 @@ public class CloudBlobCoreFileStorageService : ICoreFileStorageService
private static readonly HashSet<string> KnownPublicFolders = new HashSet<string> {
CoreConstants.PackagesFolderName,
CoreConstants.PackageBackupsFolderName,
CoreConstants.DownloadsFolderName
CoreConstants.DownloadsFolderName,
CoreConstants.SymbolPackagesFolderName,
CoreConstants.SymbolPackageBackupsFolderName
};

private static readonly HashSet<string> KnownPrivateFolders = new HashSet<string> {
Expand Down Expand Up @@ -537,6 +539,8 @@ private static string GetContentType(string folderName)
case CoreConstants.PackageBackupsFolderName:
case CoreConstants.UploadsFolderName:
case CoreConstants.ValidationFolderName:
case CoreConstants.SymbolPackagesFolderName:
case CoreConstants.SymbolPackageBackupsFolderName:
return CoreConstants.PackageContentType;

case CoreConstants.DownloadsFolderName:
Expand Down

0 comments on commit 760a814

Please sign in to comment.