Skip to content

Commit

Permalink
[Organizations] Minor bug fixes from dev (#5576)
Browse files Browse the repository at this point in the history
  • Loading branch information
Scott Bommarito authored Mar 5, 2018
1 parent c988d4b commit a5d96df
Showing 4 changed files with 12 additions and 4 deletions.
5 changes: 5 additions & 0 deletions src/NuGetGallery/Scripts/gallery/page-add-organization.js
Original file line number Diff line number Diff line change
@@ -41,4 +41,9 @@

_gravatar.attr("src", src);
}

// Immediately fetch the image if the email box is filled in initially.
if (_emailBox.val()) {
UpdateGravatar();
}
});
4 changes: 1 addition & 3 deletions src/NuGetGallery/Services/UserService.cs
Original file line number Diff line number Diff line change
@@ -383,9 +383,7 @@ public async Task<Organization> AddOrganizationAsync(string username, string ema
}

var existingUserWithIdentity = EntitiesContext.Users
.FirstOrDefault(u =>
u.Username.Equals(username, StringComparison.OrdinalIgnoreCase) ||
string.Equals(u.EmailAddress, emailAddress, StringComparison.OrdinalIgnoreCase));
.FirstOrDefault(u => u.Username == username || u.EmailAddress == emailAddress);
if (existingUserWithIdentity != null)
{
if (existingUserWithIdentity.Username.Equals(username, StringComparison.OrdinalIgnoreCase))
4 changes: 4 additions & 0 deletions src/NuGetGallery/Views/NuGetViewBase.cs
Original file line number Diff line number Diff line change
@@ -29,6 +29,8 @@ public User CurrentUser
get { return NuGetContext.CurrentUser; }
}

public Lazy<IContentObjectService> ContentObjectService => new Lazy<IContentObjectService>(() => DependencyResolver.Current.GetService<IContentObjectService>());

public CookieConsentMessage CookieConsentMessage
{
get { return _cookieConsentMessage.Value; }
@@ -82,6 +84,8 @@ public User CurrentUser
get { return NuGetContext.CurrentUser; }
}

public Lazy<IContentObjectService> ContentObjectService => new Lazy<IContentObjectService>(() => DependencyResolver.Current.GetService<IContentObjectService>());

public CookieConsentMessage CookieConsentMessage
{
get { return _cookieConsentMessage.Value; }
3 changes: 2 additions & 1 deletion src/NuGetGallery/Views/Shared/Gallery/Header.cshtml
Original file line number Diff line number Diff line change
@@ -118,7 +118,8 @@
<li role="presentation"><a href="@Url.AccountSettings()" role="menuitem">Account Settings</a></li>
<li role="presentation"><a href="@Url.ManageMyApiKeys()" role="menuitem">API Keys</a></li>
<li class="divider"></li>
@if (CurrentUser.Organizations.Any())
@if (CurrentUser.Organizations.Any() ||
ContentObjectService.Value.LoginDiscontinuationConfiguration.AreOrganizationsSupportedForUser(CurrentUser))
{
<li role="presentation"><a href="@Url.ManageMyOrganizations()" role="menuitem">Manage Organizations</a></li>
}

0 comments on commit a5d96df

Please sign in to comment.