Skip to content

Commit 4427e2b

Browse files
authored
Merge pull request #9080 from NuGet/dev
[ReleasePrep][2022.03.28]RI of dev into main
2 parents 6136fc9 + 03457f9 commit 4427e2b

40 files changed

Lines changed: 1382 additions & 242 deletions

src/AccountDeleter/Configuration/GalleryConfiguration.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,5 +114,6 @@ public string SiteRoot
114114
public int? MinIoThreads { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
115115
public int? MaxIoThreads { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
116116
public string InternalMicrosoftTenantKey { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
117+
public string AdminSenderUser { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
117118
}
118119
}

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

Lines changed: 9 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: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2344,12 +2344,14 @@ if (typeof jQuery === 'undefined') {
23442344
.removeClass('active')
23452345
.end()
23462346
.find('[data-toggle="tab"]')
2347+
.attr('tabindex', "-1")
23472348
.attr('aria-expanded', false)
23482349
.attr('aria-selected', false)
23492350

23502351
element
23512352
.addClass('active')
23522353
.find('[data-toggle="tab"]')
2354+
.attr('tabindex', "0")
23532355
.attr('aria-expanded', true)
23542356
.attr('aria-selected', true)
23552357

@@ -2381,6 +2383,25 @@ if (typeof jQuery === 'undefined') {
23812383
$active.removeClass('in')
23822384
}
23832385

2386+
Tab.prototype.navigateTabLeft = function () {
2387+
var $this = this.element
2388+
2389+
if ($this.parent('li').is($this.closest('ul').children().first())) return
2390+
2391+
var $target = $this.parent('li').prev().children('a')[0]
2392+
2393+
$target.focus()
2394+
}
2395+
2396+
Tab.prototype.navigateTabRight = function () {
2397+
var $this = this.element
2398+
2399+
if ($this.parent('li').is($this.closest('ul').children().last())) return
2400+
2401+
var $target = $this.parent('li').next().children('a')[0]
2402+
2403+
$target.focus()
2404+
}
23842405

23852406
// TAB PLUGIN DEFINITION
23862407
// =====================
@@ -2413,14 +2434,38 @@ if (typeof jQuery === 'undefined') {
24132434
// TAB DATA-API
24142435
// ============
24152436

2437+
var keys = {
2438+
left: 37,
2439+
right: 39,
2440+
up: 38,
2441+
down: 40
2442+
}
2443+
24162444
var clickHandler = function (e) {
24172445
e.preventDefault()
24182446
Plugin.call($(this), 'show')
24192447
}
24202448

2449+
var keyUpHandler = function (e) {
2450+
e.preventDefault()
2451+
2452+
// normalized for broswer compatibility
2453+
var code = e.keyCode || e.which;
2454+
2455+
switch (code) {
2456+
case keys.left:
2457+
Plugin.call($(this), 'navigateTabLeft')
2458+
break;
2459+
case keys.right:
2460+
Plugin.call($(this), 'navigateTabRight')
2461+
break;
2462+
}
2463+
}
2464+
24212465
$(document)
24222466
.on('click.bs.tab.data-api', '[data-toggle="tab"]', clickHandler)
24232467
.on('click.bs.tab.data-api', '[data-toggle="pill"]', clickHandler)
2468+
.on('keyup', '[data-toggle="tab"]', keyUpHandler)
24242469

24252470
}(jQuery);
24262471

src/Bootstrap/js/tab.js

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,14 @@
7676
.removeClass('active')
7777
.end()
7878
.find('[data-toggle="tab"]')
79+
.attr('tabindex', "-1")
7980
.attr('aria-expanded', false)
8081
.attr('aria-selected', false)
8182

8283
element
8384
.addClass('active')
8485
.find('[data-toggle="tab"]')
86+
.attr('tabindex', "0")
8587
.attr('aria-expanded', true)
8688
.attr('aria-selected', true)
8789

@@ -113,6 +115,25 @@
113115
$active.removeClass('in')
114116
}
115117

118+
Tab.prototype.navigateTabLeft = function () {
119+
var $this = this.element
120+
121+
if ($this.parent('li').is($this.closest('ul').children().first())) return
122+
123+
var $target = $this.parent('li').prev().children('a')[0]
124+
125+
$target.focus()
126+
}
127+
128+
Tab.prototype.navigateTabRight = function () {
129+
var $this = this.element
130+
131+
if ($this.parent('li').is($this.closest('ul').children().last())) return
132+
133+
var $target = $this.parent('li').next().children('a')[0]
134+
135+
$target.focus()
136+
}
116137

117138
// TAB PLUGIN DEFINITION
118139
// =====================
@@ -145,13 +166,37 @@
145166
// TAB DATA-API
146167
// ============
147168

169+
var keys = {
170+
left: 37,
171+
right: 39,
172+
up: 38,
173+
down: 40
174+
}
175+
148176
var clickHandler = function (e) {
149177
e.preventDefault()
150178
Plugin.call($(this), 'show')
151179
}
152180

181+
var keyUpHandler = function (e) {
182+
e.preventDefault()
183+
184+
// normalized for broswer compatibility
185+
var code = e.keyCode || e.which;
186+
187+
switch (code) {
188+
case keys.left:
189+
Plugin.call($(this), 'navigateTabLeft')
190+
break;
191+
case keys.right:
192+
Plugin.call($(this), 'navigateTabRight')
193+
break;
194+
}
195+
}
196+
153197
$(document)
154198
.on('click.bs.tab.data-api', '[data-toggle="tab"]', clickHandler)
155199
.on('click.bs.tab.data-api', '[data-toggle="pill"]', clickHandler)
200+
.on('keyup', '[data-toggle="tab"]', keyUpHandler)
156201

157202
}(jQuery);
Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
.page-admin-index {
22
h2 {
33
margin-bottom: 8px;
4-
margin-top: 32px;
4+
margin-top: 8px;
5+
font-size: 30px;
6+
7+
.ms-Icon {
8+
font-size: 2.4rem;
9+
top: 2px;
10+
}
11+
}
12+
13+
p {
14+
margin-bottom: 16px;
515
}
616
}

src/GitHubVulnerabilities2Db/Gallery/ThrowingTelemetryService.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,11 @@ public void TrackUserPackageDeleteExecuted(int packageKey, string packageId, str
376376
throw new NotImplementedException();
377377
}
378378

379+
public void TrackApiRequest(string endpoint)
380+
{
381+
throw new NotImplementedException();
382+
}
383+
379384
public void TrackVerifyPackageKeyEvent(string packageId, string packageVersion, User user, IIdentity identity, int statusCode)
380385
{
381386
throw new NotImplementedException();

src/NuGetGallery.Services/Authentication/AsyncFileUpload/AsyncFileUploadModule.cs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,6 @@ private void ReadStream(Stream stream, HttpRequest request, string uploadKey, As
8787
}
8888

8989
_cacheService.SetProgress(uploadKey, progress);
90-
91-
#if DEBUG
92-
if (request.IsLocal)
93-
{
94-
// If the request is from local machine, the upload will be too fast to see the progress.
95-
// Slow it down a bit.
96-
System.Threading.Thread.Sleep(30);
97-
}
98-
#endif
9990
}
10091
}
10192

src/NuGetGallery.Services/Configuration/AppConfiguration.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,5 +418,6 @@ public string ExternalBrandingMessage
418418
[DefaultValue(null)]
419419
public int? MaxIoThreads { get; set; }
420420
public string InternalMicrosoftTenantKey { get; set; }
421+
public string AdminSenderUser { get; set; }
421422
}
422423
}

src/NuGetGallery.Services/Configuration/IAppConfiguration.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,5 +501,14 @@ public interface IAppConfiguration : IMessageServiceConfiguration
501501
/// https://docs.microsoft.com/en-us/previous-versions/dotnet/netframework-4.0/7w2sway1(v=vs.100)?redirectedfrom=MSDN
502502
/// </summary>
503503
int? MaxIoThreads { get; set; }
504+
505+
/// <summary>
506+
/// The username of the user that can be entered as the sender for admin flows. When an admin flow may send one
507+
/// or more emails to end users, it helps to mask the identity of the site admin that performed the action by
508+
/// using this user instead. This account is not created automatically. The username should refer to a user
509+
/// account (not organization) that has an email address that can be visible for administrative notices. This
510+
/// account should not have any credentials or be marked as a site admin.
511+
/// </summary>
512+
string AdminSenderUser { get; set; }
504513
}
505514
}

src/NuGetGallery.Services/PackageManagement/IPackageOwnershipManagementService.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright (c) .NET Foundation. All rights reserved.
22
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33

4+
using System;
45
using System.Collections.Generic;
56
using System.Threading.Tasks;
67
using NuGet.Services.Entities;
@@ -54,17 +55,21 @@ public interface IPackageOwnershipManagementService
5455
/// <param name="packageRegistration">The package registration that is intended to get ownership.</param>
5556
/// <param name="requestingUser">The user requesting to remove an owner from the package.</param>
5657
/// <param name="userToBeRemoved">The user to remove as an owner from the package.</param>
57-
Task RemovePackageOwnerWithMessagesAsync(PackageRegistration packageRegistration, User requestingUser, User userToBeRemoved);
58+
/// <param name="requireNamespaceOwnership">Whether or not to verify that the <paramref name="requestingUser"/> has permissions for any reserved namespaces that the package is in.</param>
59+
/// <exception cref="InvalidOperationException">Thrown if <paramref name="requireNamespaceOwnership"/> is true and the <paramref name="requestingUser"/> does not have permissions for an existing namespace.</exception>
60+
Task RemovePackageOwnerWithMessagesAsync(PackageRegistration packageRegistration, User requestingUser, User userToBeRemoved, bool requireNamespaceOwnership);
5861

5962
/// <summary>
6063
/// Remove the user as from the list of owners of the package. Also remove the package registration
6164
/// from the reserved namespaces owned by this user if the Id matches any of the reserved prefixes
6265
/// and the user is the only package owner that owns the namespace that matches the package registration.
66+
/// This method verifies that the <paramref name="requestingUser"/> has the permissions to an existing namespaces.
6367
/// </summary>
6468
/// <param name="packageRegistration">The package registration that is intended to get ownership.</param>
6569
/// <param name="requestingUser">The user requesting to remove an owner from the package.</param>
6670
/// <param name="userToBeRemoved">The user to remove as an owner from the package.</param>
6771
/// <param name="commitChanges">Whether or not to commit the changes.</param>
72+
/// <exception cref="InvalidOperationException">Thrown if the <paramref name="requestingUser"/> does not have permissions for an existing namespace.</exception>
6873
Task RemovePackageOwnerAsync(PackageRegistration packageRegistration, User requestingUser, User userToBeRemoved, bool commitChanges);
6974

7075
/// <summary>

0 commit comments

Comments
 (0)