-
Notifications
You must be signed in to change notification settings - Fork 643
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move email sending for adding a package owner into the service layer #8769
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
loic-sharma
reviewed
Aug 30, 2021
src/NuGetGallery.Services/PackageManagement/PackageOwnershipManagementService.cs
Outdated
Show resolved
Hide resolved
loic-sharma
reviewed
Aug 30, 2021
src/NuGetGallery.Services/PackageManagement/PackageOwnershipManagementService.cs
Outdated
Show resolved
Hide resolved
agr
reviewed
Aug 31, 2021
loic-sharma
approved these changes
Aug 31, 2021
joelverhagen
changed the title
Move emails about ownership changes into the service layer
Move email sending for adding a package owner into the service layer
Sep 2, 2021
zhhyu
reviewed
Sep 3, 2021
zhhyu
reviewed
Sep 3, 2021
src/NuGetGallery.Services/PackageManagement/PackageOwnershipManagementService.cs
Outdated
Show resolved
Hide resolved
zhhyu
reviewed
Sep 3, 2021
zhhyu
reviewed
Sep 3, 2021
zhhyu
approved these changes
Sep 3, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Today, all of our emails (except one for AccountDeleter) are send in the ASP.NET Controller layer. This means if another location needs to perform a similar bit of business logic, the email sending code is duplicated.
This PR currently moves a single email send down from the Controller layer into the Service layer. The pieces of the PR of note are:
IUrlHelper
abstraction so the service layer can generate URLs.IPackageOwnershipManagementService.AddPackageOwnerWithMessagesAsync
.This change also closes a gap in behavior where in one case the newly added owner got an email and in another case they did not. I aligned the behavior so that all owners, new and old, got the notification email.
Alternatives considered:
IPackageOwnershipMessageService
which has thisAddPackageOwnerWithMessagesAsync
method. I thought adding a new method to and existing interface was better.AddPackageOwnerWithMessagesAsync
method have astring packageUrl
parameter soIUrlHelper
needn't exist. I didn't like this pattern since some emails that would be sent from the service layer need many URLs and therefore would have many URL parameters on their*WithMessagesAsync
methods.Thoughts?
This is related to https://github.com/NuGet/Engineering/issues/3994, which will need these service layer operations to send email.
Progress on https://github.com/NuGet/Engineering/issues/4034.