Skip to content

Commit 7659179

Browse files
authored
Merge pull request #7938 from NuGet/dev
[ReleasePrep][2020-04-07] RI dev to master
2 parents bc46376 + efe372a commit 7659179

200 files changed

Lines changed: 2579 additions & 6735 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ tools/
2929
.nuget/.marker.v*
3030
nuget.exe
3131
AssemblyInfo.g.cs
32+
*.g.txt
3233
tests/Scripts/Config-*.json
3334

3435
# MSTest test Results

build.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ param (
1010
[string]$PackageSuffix,
1111
[string]$Branch,
1212
[string]$CommitSHA,
13-
[string]$BuildBranch = 'd298565f387e93995a179ef8ae6838f1be37904f',
13+
[string]$BuildBranch = '6d1fcf147a7af8b6b4db842494bc7beed3b1d0e9',
1414
[string]$VerifyMicrosoftPackageVersion = $null
1515
)
1616

ops.cmd

Lines changed: 0 additions & 1 deletion
This file was deleted.

sign.thirdparty.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<ItemGroup>
44
<ThirdPartyBinaries Include="AnglicanGeek.MarkdownMailer.dll" />
5+
<ThirdPartyBinaries Include="Antlr3.Runtime.dll" />
56
<ThirdPartyBinaries Include="Autofac.dll" />
67
<ThirdPartyBinaries Include="Autofac.Extensions.DependencyInjection.dll" />
78
<ThirdPartyBinaries Include="Autofac.Integration.Mvc.dll" />

src/AccountDeleter/AccountDeleteMessageHandler.cs

Lines changed: 31 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -63,31 +63,42 @@ public async Task<bool> HandleAsync(AccountDeleteMessage command)
6363
throw new UserNotFoundException();
6464
}
6565

66-
if (_accountDeleteConfigurationAccessor.Value.RespectEmailContactSetting && !user.EmailAllowed)
67-
{
68-
throw new EmailContactNotAllowedException();
69-
}
70-
7166
var recipientEmail = user.EmailAddress;
67+
var emailAllowed = user.EmailAllowed;
7268
var deleteSuccess = await _accountManager.DeleteAccount(user, source);
7369
_telemetryService.TrackDeleteResult(source, deleteSuccess);
7470

75-
var baseEmailBuilder = _emailBuilderFactory.GetEmailBuilder(source, deleteSuccess);
76-
if (baseEmailBuilder != null)
71+
if (recipientEmail == null)
72+
{
73+
_logger.LogWarning("User has no confirmed email address. The user has been deleted but no email was sent.");
74+
_telemetryService.TrackUnconfirmedUser(source);
75+
messageProcessed = true;
76+
}
77+
else if (_accountDeleteConfigurationAccessor.Value.RespectEmailContactSetting && !emailAllowed)
7778
{
78-
var toEmail = new List<MailAddress>();
79+
_logger.LogWarning("User did not allow Email Contact. The user has been deleted but no email was sent.");
80+
_telemetryService.TrackEmailBlocked(source);
81+
messageProcessed = true;
82+
}
83+
else
84+
{
85+
var baseEmailBuilder = _emailBuilderFactory.GetEmailBuilder(source, deleteSuccess);
86+
if (baseEmailBuilder != null)
87+
{
88+
var toEmail = new List<MailAddress>();
7989

80-
var configuration = _accountDeleteConfigurationAccessor.Value;
81-
var senderAddress = configuration.EmailConfiguration.GalleryOwner;
82-
var ccEmail = new List<MailAddress>();
83-
toEmail.Add(new MailAddress(recipientEmail));
84-
ccEmail.Add(new MailAddress(senderAddress));
90+
var configuration = _accountDeleteConfigurationAccessor.Value;
91+
var senderAddress = configuration.EmailConfiguration.GalleryOwner;
92+
var ccEmail = new List<MailAddress>();
93+
toEmail.Add(new MailAddress(recipientEmail));
94+
ccEmail.Add(new MailAddress(senderAddress));
8595

86-
var recipients = new EmailRecipients(toEmail, ccEmail);
87-
var emailBuilder = new DisposableEmailBuilder(baseEmailBuilder, recipients, username);
88-
await _messenger.SendMessageAsync(emailBuilder);
89-
_telemetryService.TrackEmailSent(source, user.EmailAllowed);
90-
messageProcessed = true;
96+
var recipients = new EmailRecipients(toEmail, ccEmail);
97+
var emailBuilder = new DisposableEmailBuilder(baseEmailBuilder, recipients, username);
98+
await _messenger.SendMessageAsync(emailBuilder);
99+
_telemetryService.TrackEmailSent(source, emailAllowed);
100+
messageProcessed = true;
101+
}
91102
}
92103
}
93104
catch (UnknownSourceException)
@@ -98,12 +109,6 @@ public async Task<bool> HandleAsync(AccountDeleteMessage command)
98109
_telemetryService.TrackUnknownSource(source);
99110
messageProcessed = false;
100111
}
101-
catch (EmailContactNotAllowedException)
102-
{
103-
// Should we not send? or should we ignore the setting.
104-
_logger.LogWarning("User did not allow Email Contact.");
105-
_telemetryService.TrackEmailBlocked(source);
106-
}
107112
catch (UserNotFoundException)
108113
{
109114
_logger.LogWarning("User was not found. They may have already been deleted.");
@@ -112,8 +117,8 @@ public async Task<bool> HandleAsync(AccountDeleteMessage command)
112117
}
113118
catch (Exception e)
114119
{
115-
_logger.LogError(0, e, "An unknown exception occured: {ExceptionMessage}");
116-
throw e;
120+
_logger.LogError(e, "An unknown exception occurred.");
121+
throw;
117122
}
118123

119124
return messageProcessed;

src/AccountDeleter/AccountDeleter.csproj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@
6464
<Compile Include="Evaluators\IUserEvaluatorFactory.cs" />
6565
<Compile Include="Evaluators\UserEvaluatorComparer.cs" />
6666
<Compile Include="Evaluators\UserEvaluatorFactory.cs" />
67-
<Compile Include="Exceptions\EmailContactNotAllowedException.cs" />
6867
<Compile Include="Exceptions\UnknownEvaluatorException.cs" />
6968
<Compile Include="Exceptions\UnknownSourceException.cs" />
7069
<Compile Include="Exceptions\UserNotFoundException.cs" />
@@ -107,7 +106,7 @@
107106
<PrivateAssets>all</PrivateAssets>
108107
</PackageReference>
109108
<PackageReference Include="NuGet.Services.Validation.Common.Job">
110-
<Version>4.3.0-dev-3555917</Version>
109+
<Version>4.3.0-dev-3612825</Version>
111110
</PackageReference>
112111
</ItemGroup>
113112
<ItemGroup>

src/AccountDeleter/Configuration/GalleryConfiguration.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,5 +112,6 @@ public string SiteRoot
112112
public int? MaxWorkerThreads { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
113113
public int? MinIoThreads { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
114114
public int? MaxIoThreads { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
115+
public string InternalMicrosoftTenantKey { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
115116
}
116117
}

src/AccountDeleter/Exceptions/EmailContactNotAllowedException.cs

Lines changed: 0 additions & 12 deletions
This file was deleted.

src/AccountDeleter/Exceptions/UserNotFoundException.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
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-
54
using System;
65

76
namespace NuGetGallery.AccountDeleter

src/AccountDeleter/Telemetry/AccountDeleteTelemetryService.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ public class AccountDeleteTelemetryService : IAccountDeleteTelemetryService, ISu
1717
private const string EmailBlockedEventName = TelemetryPrefix + "EmailBlocked";
1818
private const string UnknownSourceEventName = TelemetryPrefix + "UnknownSource";
1919
private const string UserNotFoundEventName = TelemetryPrefix + "UserNotFound";
20+
private const string UnconfirmedUserEventName = TelemetryPrefix + "UnconfirmedUser";
2021

2122
private const string CallGuidDimensionName = "CallGuid";
2223
private const string ContactAllowedDimensionName = "ContactAllowed";
@@ -130,5 +131,14 @@ public void TrackMessageLockLost<TMessage>(Guid callGuid)
130131
{ CallGuidDimensionName, callGuid.ToString() }
131132
});
132133
}
134+
135+
public void TrackUnconfirmedUser(string source)
136+
{
137+
_telemetryClient.TrackEvent(UnconfirmedUserEventName,
138+
new Dictionary<string, string>
139+
{
140+
{ SourceDimensionName, source }
141+
});
142+
}
133143
}
134144
}

0 commit comments

Comments
 (0)