Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fixes to Manageownerspage #1798

Merged
merged 1 commit into from

4 participants

@bhuvak
Collaborator

Fixes #1760 and #1741

Validated the relevant scenarios manually.
Request folks to review the error messages as well.

@jeffhandley jeffhandley commented on the diff
src/NuGetGallery/Controllers/JsonApiController.cs
@@ -65,7 +65,11 @@ public object AddPackageOwner(string id, string username)
var user = _userService.FindByUsername(username);
if (user == null)
{
- return new { success = false, message = "Owner not found" };
+ return new { success = false, message = "Owner not found." };
+ }
+ if (!user.Confirmed)
+ {
+ return new { success = false, message = string.Format("Sorry, {0} hasn't verified his email account yet and we cannot proceed with the request.",username) };

Use "...hasn't verified their email address..." I know "their" isn't singular, but as a grammar purist myself, I say oh well.

Nit: Looks like a missing space before the username parameter. Formatting the code block would fix it.

@anurse Collaborator
anurse added a note

"they", "their", etc. are singular in exactly this case: http://dictionary.reference.com/browse/they - "(used with an indefinite singular antecedent in place of the definite masculine he or the definite feminine she)"

So even purists can be happy :)

You just made my day, good sir!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@claycompton claycompton merged commit 0f68f30 into from
@anurse
Collaborator

The grammar comment was never resolved before this was merged in. I'm going to fix that up in a separate change.

@anurse anurse deleted the branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 12, 2013
  1. @bhuvak

    Fixes to Manageownerspage

    bhuvak authored
This page is out of date. Refresh to see the latest.
View
8 src/NuGetGallery/Controllers/JsonApiController.cs
@@ -56,7 +56,7 @@ public object AddPackageOwner(string id, string username)
var package = _packageService.FindPackageRegistrationById(id);
if (package == null)
{
- return new { success = false, message = "Package not found" };
+ return new { success = false, message = "Package not found." };
}
if (!package.IsOwner(HttpContext.User))
{
@@ -65,7 +65,11 @@ public object AddPackageOwner(string id, string username)
var user = _userService.FindByUsername(username);
if (user == null)
{
- return new { success = false, message = "Owner not found" };
+ return new { success = false, message = "Owner not found." };
+ }
+ if (!user.Confirmed)
+ {
+ return new { success = false, message = string.Format("Sorry, {0} hasn't verified his email account yet and we cannot proceed with the request.",username) };

Use "...hasn't verified their email address..." I know "their" isn't singular, but as a grammar purist myself, I say oh well.

Nit: Looks like a missing space before the username parameter. Formatting the code block would fix it.

@anurse Collaborator
anurse added a note

"they", "their", etc. are singular in exactly this case: http://dictionary.reference.com/browse/they - "(used with an indefinite singular antecedent in place of the definite masculine he or the definite feminine she)"

So even purists can be happy :)

You just made my day, good sir!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
}
var currentUser = _userService.FindByUsername(HttpContext.User.Identity.Name);
View
7 src/NuGetGallery/Views/Packages/ManagePackageOwners.cshtml
@@ -55,9 +55,14 @@
addOwner: function () {
var newUsername = viewModel.newOwnerUsername();
+ if (!newUsername) {
+ viewModel.message("Please enter a valid user name.");
+ return;
+ }
+
var existingOwner = ko.utils.arrayFirst(
viewModel.owners(),
- function (owner) { return owner.name().toUpperCase() == newUsername.toUpperCase() });
+ function (owner) { return owner.name().toUpperCase() == newUsername.toUpperCase() });
if (existingOwner) {
viewModel.message("The user '" + newUsername + "' is already an owner or pending owner of this package.");
Something went wrong with that request. Please try again.