Skip to content
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

Small UI fixes #5853

Merged
merged 7 commits into from
Apr 30, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 4 additions & 16 deletions src/NuGetGallery.Core/Services/CoreMessageService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,27 +26,15 @@ public CoreMessageService(IMailSender mailSender, ICoreMessageServiceConfigurati

public void SendPackageAddedNotice(Package package, string packageUrl, string packageSupportUrl, string emailSettingsUrl)
{
string subject = "[{0}] Package published - {1} {2}";
string body = @"The package [{1} {2}]({3}) was just published on {0}. If this was not intended, please [contact support]({4}).
string subject = $"[{CoreConfiguration.GalleryOwner.DisplayName}] Package published - {package.PackageRegistration.Id} {package.Version}";
string body = $@"The package [{package.PackageRegistration.Id} {package.Version}]({packageUrl}) was recently published on {CoreConfiguration.GalleryOwner.DisplayName} by {package.User.Username}. If this was not intended, please [contact support]({packageSupportUrl}).

-----------------------------------------------
<em style=""font-size: 0.8em;"">
To stop receiving emails as an owner of this package, sign in to the {0} and
[change your email notification settings]({5}).
To stop receiving emails as an owner of this package, sign in to the {CoreConfiguration.GalleryOwner.DisplayName} and
[change your email notification settings]({emailSettingsUrl}).
</em>";

body = string.Format(
CultureInfo.CurrentCulture,
body,
CoreConfiguration.GalleryOwner.DisplayName,
package.PackageRegistration.Id,
package.Version,
packageUrl,
packageSupportUrl,
emailSettingsUrl);

subject = string.Format(CultureInfo.CurrentCulture, subject, CoreConfiguration.GalleryOwner.DisplayName, package.PackageRegistration.Id, package.Version);

using (var mailMessage = new MailMessage())
{
mailMessage.Subject = subject;
Expand Down
20 changes: 4 additions & 16 deletions src/NuGetGallery/Services/MessageService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -638,29 +638,17 @@ private void SendSupportMessage(User user, string body, string subject)

public void SendPackageUploadedNotice(Package package, string packageUrl, string packageSupportUrl, string emailSettingsUrl)
{
string subject = "[{0}] Package uploaded - {1} {2}";
string body = @"The package [{1} {2}]({3}) was just uploaded to {0}. If this was not intended, please [contact support]({4}).
string subject = $"[{Config.GalleryOwner.DisplayName}] Package uploaded - {package.PackageRegistration.Id} {package.Version}";
string body = $@"The package [{package.PackageRegistration.Id} {package.Version}]({packageUrl}) was recently uploaded to {Config.GalleryOwner.DisplayName} by {package.User.Username}. If this was not intended, please [contact support]({packageSupportUrl}).

Note: This package has not been published yet. It will appear in search results and will be available for install/restore after both validation and indexing are complete. Package validation and indexing may take up to an hour.

-----------------------------------------------
<em style=""font-size: 0.8em;"">
To stop receiving emails as an owner of this package, sign in to the {0} and
[change your email notification settings]({5}).
To stop receiving emails as an owner of this package, sign in to the {Config.GalleryOwner.DisplayName} and
[change your email notification settings]({emailSettingsUrl}).
</em>";

body = String.Format(
CultureInfo.CurrentCulture,
body,
Config.GalleryOwner.DisplayName,
package.PackageRegistration.Id,
package.Version,
packageUrl,
packageSupportUrl,
emailSettingsUrl);

subject = String.Format(CultureInfo.CurrentCulture, subject, Config.GalleryOwner.DisplayName, package.PackageRegistration.Id, package.Version);

using (var mailMessage = new MailMessage())
{
mailMessage.Subject = subject;
Expand Down
4 changes: 2 additions & 2 deletions src/NuGetGallery/Strings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/NuGetGallery/Strings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="EmailAddressBeingUsed" xml:space="preserve">
<value>The email address '{0}' is being used.</value>
<value>The email address '{0}' is already in use by a different account.</value>
</data>
<data name="UsernameNotAvailable" xml:space="preserve">
<value>The username '{0}' is not available.</value>
Expand Down Expand Up @@ -726,7 +726,7 @@ For more information, please contact '{2}'.</value>
</data>
<data name="AccountIsLinkedToAnotherExternalAccount" xml:space="preserve">
<value>The account with the email {0} is linked to another Microsoft account.
If you wish to update the linked Microsoft account you can do so from the account settings page.</value>
If you would like to update the linked Microsoft account you can do so from the account settings page.</value>
</data>
<data name="ChangeCredential_Failed" xml:space="preserve">
<value>Failed to update the Microsoft account with '{0}'. This could happen if it is already linked to another NuGet account. Contact support for more information.</value>
Expand Down
4 changes: 2 additions & 2 deletions src/NuGetGallery/Views/Authentication/LinkExternal.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@
The account with the email @Model.SignIn.UserNameOrEmail is linked to another Microsoft account.
</p>
<p class="text-center">
If you wish to update the linked Microsoft account you can do so from the account settings page.
If you would like to update the linked Microsoft account you can do so from the account settings page.
</p>
break;
case AssociateExternalAccountViewModel.ExistingUserLinkingErrorType.AccountIsOrganization:
<p class="text-center">
The email @Model.SignIn.UserNameOrEmail is linked to an organization.
</p>
<p class="text-center">
If you wish to manage the organization account, you must sign in as one of its admins.
If you would like to manage the organization account, you must sign in as one of its admins.
</p>
break;
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

<script type="text/html" id="error-container">
<p class="role-description" data-bind="visible: !Error()">
<span data-bind="text: NewMemberRoleDescription"></span>&nbsp;<a href="https://go.microsoft.com/fwlink/?linkid=870439">Learn more.</a>
<span data-bind="text: NewMemberRoleDescription"></span>&nbsp;<a href="https://go.microsoft.com/fwlink/?linkid=870439#managing-organization-members">Learn more.</a>
</p>
<!-- ko if: Error -->
@ViewHelpers.AlertDanger(@<text><span data-bind="html: Error"></span></text>)
Expand Down
2 changes: 1 addition & 1 deletion src/NuGetGallery/Views/Packages/ConfirmOwner.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
@* Note that we're not confirming that a request even exists for this user, it's just a string compare against the name in the URL *@
@ViewHelpers.AlertDanger(
@<text>
This request link is for the user '@Model.Username'. If you wish to accept it,
This request link is for the user '@Model.Username'. If you would like to accept it,
please sign in as that user and click the link again.
</text>
)
Expand Down
4 changes: 2 additions & 2 deletions src/NuGetGallery/Views/Shared/ConfirmationRequired.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
ViewBag.Title = "Confirm Your "
+ (Model.IsOrganization ? "Organization " : "")
+ (Model.ConfirmingNewAccount ? "Account" : "Email");
ViewBag.SmPageColumns = Constants.ColumnsAuthenticationSm;
ViewBag.MdPageColumns = Constants.ColumnsAuthenticationMd;
ViewBag.SmPageColumns = Constants.ColumnsWideAuthenticationSm;
ViewBag.MdPageColumns = Constants.ColumnsWideAuthenticationMd;
Layout = "~/Views/Shared/Gallery/Layout.cshtml";

if (Model.IsOrganization)
Expand Down
10 changes: 3 additions & 7 deletions src/NuGetGallery/Views/Users/Organizations.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -89,21 +89,17 @@
}
else
{
<p>Organizations allow you to manage and publish packages as a team or a group. <a href="https://go.microsoft.com/fwlink/?linkid=870439">Learn more.</a></p>
<div class="organizations-empty text-center">
<img width="260" height="150" alt="You are not a member of any organizations"
src="~/Content/gallery/img/manage-organizations.svg"
@ViewHelpers.ImageFallback(Url.Absolute("~/Content/gallery/img/manage-organizations-260x150.png")) />
</div>
<div class="subtitle text-center">
<p>Organizations allow you to manage and publish packages as a team or a group.</p>
<p>You are not a member of any organizations. Get started by <a href="@Url.AddOrganization()">adding a new organization.</a></p>
</div>
<div class="subtitle text-center">
<form action="@Url.AddOrganization()">
<input type="submit" class="btn btn-primary" value="Add new organization" />
</form>
</div>
<div class="subtitle text-center">
<a href="@Url.TransformAccount()">Transform your account into an organization</a>
You can also <a href="@Url.TransformAccount()">transform your account into an organization.</a>
</div>
}
</div>
Expand Down
22 changes: 14 additions & 8 deletions tests/NuGetGallery.Facts/Services/MessageServiceFacts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1027,7 +1027,8 @@ public void WillSendEmailToAllOwners(string version)
var package = new Package
{
Version = version,
PackageRegistration = packageRegistration
PackageRegistration = packageRegistration,
User = new User("userThatPushed")
};
packageRegistration.Packages.Add(package);

Expand All @@ -1046,7 +1047,7 @@ public void WillSendEmailToAllOwners(string version)
Assert.Equal(TestGalleryNoReplyAddress, message.From);
Assert.Contains($"[{TestGalleryOwner.DisplayName}] Package published - {packageRegistration.Id} {nugetVersion.ToNormalizedString()}", message.Subject);
Assert.Contains(
$"The package [{packageRegistration.Id} {nugetVersion.ToFullString()}]({packageUrl}) was just published on {TestGalleryOwner.DisplayName}. If this was not intended, please [contact support]({supportUrl}).", message.Body);
$"The package [{packageRegistration.Id} {nugetVersion.ToFullString()}]({packageUrl}) was recently published on {TestGalleryOwner.DisplayName} by {package.User.Username}. If this was not intended, please [contact support]({supportUrl}).", message.Body);
}

[Fact]
Expand All @@ -1065,7 +1066,8 @@ public void WillNotSendEmailToOwnerThatOptsOut()
var package = new Package
{
Version = "1.2.3",
PackageRegistration = packageRegistration
PackageRegistration = packageRegistration,
User = new User("userThatPushed")
};
packageRegistration.Packages.Add(package);

Expand Down Expand Up @@ -1096,7 +1098,8 @@ public void WillNotAttemptToSendIfNoOwnersAllow()
var package = new Package
{
Version = "1.2.3",
PackageRegistration = packageRegistration
PackageRegistration = packageRegistration,
User = new User("userThatPushed")
};
packageRegistration.Packages.Add(package);

Expand Down Expand Up @@ -1406,7 +1409,8 @@ public void WillSendEmailToAllOwners(string version)
var package = new Package
{
Version = version,
PackageRegistration = packageRegistration
PackageRegistration = packageRegistration,
User = new User("userThatPushed")
};
packageRegistration.Packages.Add(package);

Expand All @@ -1426,7 +1430,7 @@ public void WillSendEmailToAllOwners(string version)
Assert.Contains($"[{TestGalleryOwner.DisplayName}] Package uploaded - {packageRegistration.Id} {nugetVersion.ToNormalizedString()}", message.Subject);
Assert.DoesNotContain("publish", message.Subject);
Assert.Contains(
$"The package [{packageRegistration.Id} {nugetVersion.ToFullString()}]({packageUrl}) was just uploaded to {TestGalleryOwner.DisplayName}. If this was not intended, please [contact support]({supportUrl}).", message.Body);
$"The package [{packageRegistration.Id} {nugetVersion.ToFullString()}]({packageUrl}) was recently uploaded to {TestGalleryOwner.DisplayName} by {package.User.Username}. If this was not intended, please [contact support]({supportUrl}).", message.Body);
}

[Fact]
Expand All @@ -1445,7 +1449,8 @@ public void WillNotSendEmailToOwnerThatOptsOut()
var package = new Package
{
Version = "1.2.3",
PackageRegistration = packageRegistration
PackageRegistration = packageRegistration,
User = new User("userThatPushed")
};
packageRegistration.Packages.Add(package);

Expand Down Expand Up @@ -1476,7 +1481,8 @@ public void WillNotAttemptToSendIfNoOwnersAllow()
var package = new Package
{
Version = "1.2.3",
PackageRegistration = packageRegistration
PackageRegistration = packageRegistration,
User = new User("userThatPushed")
};
packageRegistration.Packages.Add(package);

Expand Down