Skip to content

Commit e32d1c2

Browse files
authored
Merge pull request #9483 from NuGet/dev
[ReleasePrep][2023.04.25]RI of dev into main
2 parents 0931f8b + 3ebfdea commit e32d1c2

32 files changed

+793
-104
lines changed

src/Bootstrap/dist/css/bootstrap-theme.css

Lines changed: 36 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Bootstrap/dist/js/bootstrap.js

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,8 @@ if (typeof jQuery === 'undefined') {
585585
toggle: true
586586
}
587587

588+
Collapse.ARIA_EXPANDED_ALLOWED_ROLES = ['application', 'button', 'checkbox', 'combobox', 'gridcell', 'link', 'listbox', 'menuitem', 'row', 'rowheader', 'tab', 'treeitem']
589+
588590
Collapse.prototype.dimension = function () {
589591
var hasWidth = this.$element.hasClass('width')
590592
return hasWidth ? 'width' : 'height'
@@ -615,7 +617,11 @@ if (typeof jQuery === 'undefined') {
615617
this.$element
616618
.removeClass('collapse')
617619
.addClass('collapsing')[dimension](0)
618-
.attr('aria-expanded', true)
620+
621+
// the aria-expanded attribute is only allowed when the element has an allowed role
622+
if (Collapse.ARIA_EXPANDED_ALLOWED_ROLES.includes(this.$element.attr('role'))) {
623+
this.$element.attr('aria-expanded', true)
624+
}
619625

620626
this.$trigger
621627
.removeClass('collapsed')
@@ -655,7 +661,11 @@ if (typeof jQuery === 'undefined') {
655661
this.$element
656662
.addClass('collapsing')
657663
.removeClass('collapse in')
658-
.attr('aria-expanded', false)
664+
665+
// the aria-expanded attribute is only allowed when the element has an allowed role
666+
if (Collapse.ARIA_EXPANDED_ALLOWED_ROLES.includes(this.$element.attr('role'))) {
667+
this.$element.attr('aria-expanded', false)
668+
}
659669

660670
this.$trigger
661671
.addClass('collapsed')
@@ -696,7 +706,10 @@ if (typeof jQuery === 'undefined') {
696706
Collapse.prototype.addAriaAndCollapsedClass = function ($element, $trigger) {
697707
var isOpen = $element.hasClass('in')
698708

699-
$element.attr('aria-expanded', isOpen)
709+
if (Collapse.ARIA_EXPANDED_ALLOWED_ROLES.includes(this.$element.attr('role'))) {
710+
$element.attr('aria-expanded', isOpen)
711+
}
712+
700713
$trigger
701714
.toggleClass('collapsed', !isOpen)
702715
.attr('aria-expanded', isOpen)
@@ -2345,14 +2358,12 @@ if (typeof jQuery === 'undefined') {
23452358
.end()
23462359
.find('[data-toggle="tab"]')
23472360
.attr('tabindex', "-1")
2348-
.attr('aria-expanded', false)
23492361
.attr('aria-selected', false)
23502362

23512363
element
23522364
.addClass('active')
23532365
.find('[data-toggle="tab"]')
23542366
.attr('tabindex', "0")
2355-
.attr('aria-expanded', true)
23562367
.attr('aria-selected', true)
23572368

23582369
if (transition) {

src/Bootstrap/js/collapse.js

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838
toggle: true
3939
}
4040

41+
Collapse.ARIA_EXPANDED_ALLOWED_ROLES = ['application', 'button', 'checkbox', 'combobox', 'gridcell', 'link', 'listbox', 'menuitem', 'row', 'rowheader', 'tab', 'treeitem']
42+
4143
Collapse.prototype.dimension = function () {
4244
var hasWidth = this.$element.hasClass('width')
4345
return hasWidth ? 'width' : 'height'
@@ -68,7 +70,11 @@
6870
this.$element
6971
.removeClass('collapse')
7072
.addClass('collapsing')[dimension](0)
71-
.attr('aria-expanded', true)
73+
74+
// the aria-expanded attribute is only allowed when the element has an allowed role
75+
if (Collapse.ARIA_EXPANDED_ALLOWED_ROLES.includes(this.$element.attr('role'))) {
76+
this.$element.attr('aria-expanded', true)
77+
}
7278

7379
this.$trigger
7480
.removeClass('collapsed')
@@ -108,7 +114,11 @@
108114
this.$element
109115
.addClass('collapsing')
110116
.removeClass('collapse in')
111-
.attr('aria-expanded', false)
117+
118+
// the aria-expanded attribute is only allowed when the element has an allowed role
119+
if (Collapse.ARIA_EXPANDED_ALLOWED_ROLES.includes(this.$element.attr('role'))) {
120+
this.$element.attr('aria-expanded', false)
121+
}
112122

113123
this.$trigger
114124
.addClass('collapsed')
@@ -149,7 +159,10 @@
149159
Collapse.prototype.addAriaAndCollapsedClass = function ($element, $trigger) {
150160
var isOpen = $element.hasClass('in')
151161

152-
$element.attr('aria-expanded', isOpen)
162+
if (Collapse.ARIA_EXPANDED_ALLOWED_ROLES.includes(this.$element.attr('role'))) {
163+
$element.attr('aria-expanded', isOpen)
164+
}
165+
153166
$trigger
154167
.toggleClass('collapsed', !isOpen)
155168
.attr('aria-expanded', isOpen)

src/Bootstrap/js/tab.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,12 @@
7777
.end()
7878
.find('[data-toggle="tab"]')
7979
.attr('tabindex', "-1")
80-
.attr('aria-expanded', false)
8180
.attr('aria-selected', false)
8281

8382
element
8483
.addClass('active')
8584
.find('[data-toggle="tab"]')
8685
.attr('tabindex', "0")
87-
.attr('aria-expanded', true)
8886
.attr('aria-selected', true)
8987

9088
if (transition) {

src/Bootstrap/less/theme/common-list-packages.less

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,30 @@
5858
margin-top: 75px;
5959
margin-bottom: 0px;
6060
}
61+
62+
@severe-warning-background-color: rgb(254, 217, 204);
63+
@severe-warning-icon-color: rgb(216, 59, 1);
64+
@warning-background-color: rgb(255, 244, 206);
65+
@package-warning-color: rgb(50, 49, 48);
66+
@badge-border-radius: 2px;
67+
68+
.package-warning {
69+
padding-right: 8px;
70+
padding-left: 8px;
71+
border-radius: @badge-border-radius;
72+
margin-right: 5px;
73+
color: @package-warning-color
74+
}
75+
76+
.package-warning--vulnerable {
77+
.package-warning;
78+
background-color: @severe-warning-background-color;
79+
i {
80+
color: @severe-warning-icon-color;
81+
}
82+
}
83+
84+
.package-warning--deprecated {
85+
.package-warning;
86+
background-color: @warning-background-color;
87+
}

src/Bootstrap/less/theme/page-api-keys.less

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,11 @@
132132
border-left: 1px solid @gray-lighter;
133133
}
134134
}
135+
.package-list {
136+
li {
137+
overflow-y: visible;
138+
}
139+
}
135140
}
136141

137142
.api-key-details:not(:first-child)

src/Bootstrap/less/theme/page-display-package.less

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,11 +248,19 @@
248248
overflow: hidden;
249249
white-space: nowrap;
250250
text-overflow: ellipsis;
251+
252+
.profile-icon {
253+
margin: 1.5px;
254+
}
255+
256+
.username{
257+
margin-left: 6.5px;
258+
}
251259
}
252260

253261
img {
254-
margin-right: 8px;
255262
border-radius: 5px;
263+
margin: 2px;
256264
}
257265
}
258266

src/NuGetGallery/App_Code/ViewHelpers.cshtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,7 @@ var hlp = new AccordionHelper(name, formModelStatePrefix, expanded, page);
577577
</div>
578578
if (!disabled)
579579
{
580-
<div aria-controls="panel-body" class="panel panel-default panel-collapse collapse @(expanded ? "in" : string.Empty)"
580+
<div class="panel panel-default panel-collapse collapse @(expanded ? "in" : string.Empty)"
581581
id="@id-container">
582582
<div class="panel-body">
583583
@content(MvcHtmlString.Empty)

src/NuGetGallery/App_Data/Files/Content/Trusted-Image-Domains.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
"sonarcloud.io",
3535
"travis-ci.com",
3636
"travis-ci.org",
37+
"wakatime.com",
3738
"avatars.githubusercontent.com",
3839
"raw.github.com",
3940
"raw.githubusercontent.com",
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
// Copyright (c) .NET Foundation. All rights reserved.
2+
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3+
4+
using System;
5+
using System.Collections.Generic;
6+
using System.Linq;
7+
using Newtonsoft.Json.Linq;
8+
using NuGet.Services.Entities;
9+
10+
namespace NuGetGallery.Helpers
11+
{
12+
public static class SearchResponseHelper
13+
{
14+
public static ICollection<PackageDeprecation> GetDeprecationsOrNull(JToken docDeprecation)
15+
{
16+
PackageDeprecation deprecation = null;
17+
if (docDeprecation != null)
18+
{
19+
var docReasons = docDeprecation.Value<JArray>("Reasons");
20+
if (docReasons != null && docReasons.HasValues)
21+
{
22+
PackageDeprecationStatus status = PackageDeprecationStatus.NotDeprecated;
23+
foreach (var reason in docReasons)
24+
{
25+
if (Enum.TryParse<PackageDeprecationStatus>(reason.Value<string>(), out var pdStatus))
26+
{
27+
status |= pdStatus;
28+
}
29+
}
30+
31+
var docAlternatePackage = docDeprecation["AlternatePackage"];
32+
Package alternatePackage = null;
33+
if (docAlternatePackage != null)
34+
{
35+
var range = docAlternatePackage.Value<string>("Range");
36+
var id = docAlternatePackage.Value<string>("Id");
37+
if (!string.IsNullOrEmpty(range) && !string.IsNullOrEmpty(id))
38+
{
39+
var version = string.Empty;
40+
var commaIndex = range.IndexOf(",");
41+
if (range.StartsWith("[") && commaIndex > 0)
42+
{
43+
var startIndex = 1;
44+
version = range.Substring(startIndex, commaIndex - startIndex);
45+
}
46+
47+
alternatePackage = new Package()
48+
{
49+
Id = id,
50+
Version = version
51+
};
52+
}
53+
}
54+
55+
deprecation = new PackageDeprecation()
56+
{
57+
CustomMessage = docDeprecation.Value<string>("Message"),
58+
Status = status,
59+
AlternatePackage = alternatePackage
60+
};
61+
}
62+
}
63+
64+
return deprecation == null ? null : new List<PackageDeprecation>() { deprecation };
65+
}
66+
67+
public static ICollection<VulnerablePackageVersionRange> GetVulnerabilities(JArray docVulnerabilities)
68+
{
69+
var vulnerabilities = new List<VulnerablePackageVersionRange>();
70+
if (docVulnerabilities != null)
71+
{
72+
vulnerabilities = docVulnerabilities.Select(v => new VulnerablePackageVersionRange()
73+
{
74+
Vulnerability = new PackageVulnerability()
75+
{
76+
AdvisoryUrl = v.Value<string>("AdvisoryUrl"),
77+
Severity = (PackageVulnerabilitySeverity)v.Value<int>("Severity")
78+
}
79+
})
80+
.ToList();
81+
}
82+
83+
return vulnerabilities;
84+
}
85+
}
86+
}

0 commit comments

Comments
 (0)