Skip to content

Commit

Permalink
updating ReportAbuse form based on LCA feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
xavierdecoster committed Jul 15, 2015
1 parent 9866b63 commit a0ff162
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 20 deletions.
6 changes: 3 additions & 3 deletions src/NuGetGallery/Controllers/PackagesController.cs
Expand Up @@ -488,10 +488,10 @@ public virtual ActionResult ReportAbuse(string id, string version, ReportAbuseVi
Reason = EnumHelper.GetDescription(reportForm.Reason.Value),
RequestingUser = user,
Url = Url,
CopySender = reportForm.CopySender
CopySender = reportForm.CopySender,
Signature = reportForm.Signature
};
_messageService.ReportAbuse(request
);
_messageService.ReportAbuse(request);

TempData["Message"] = "Your abuse report has been sent to the gallery operators.";
return Redirect(Url.Package(id, version));
Expand Down
12 changes: 7 additions & 5 deletions src/NuGetGallery/Services/MessageService.cs
Expand Up @@ -38,6 +38,8 @@ public void ReportAbuse(ReportPackageRequest request)
const string bodyTemplate = @"
**Email:** {Name} ({Address})
**Signature:** {Signature}
**Package:** {Id}
{PackageUrl}
Expand Down Expand Up @@ -135,7 +137,7 @@ public void SendContactOwnersMessage(MailAddress fromAddress, PackageRegistratio
-----------------------------------------------
<em style=""font-size: 0.8em;"">
To stop receiving contact emails as an owner of this package, sign in to the {4} and
To stop receiving contact emails as an owner of this package, sign in to the {4} and
[change your email notification settings]({5}).
</em>";

Expand Down Expand Up @@ -169,7 +171,7 @@ public void SendContactOwnersMessage(MailAddress fromAddress, PackageRegistratio

public void SendNewAccountEmail(MailAddress toAddress, string confirmationUrl)
{
string body = @"Thank you for registering with the {0}.
string body = @"Thank you for registering with the {0}.
We can't wait to see what packages you'll upload.
So we can be sure to contact you, please verify your email address and click the following link:
Expand Down Expand Up @@ -199,7 +201,7 @@ public void SendNewAccountEmail(MailAddress toAddress, string confirmationUrl)

public void SendEmailChangeConfirmationNotice(MailAddress newEmailAddress, string confirmationUrl)
{
string body = @"You recently changed your {0} email address.
string body = @"You recently changed your {0} email address.
To verify your new email address, please click the following link:
Expand Down Expand Up @@ -231,7 +233,7 @@ public void SendEmailChangeNoticeToPreviousEmailAddress(User user, string oldEma
{
string body = @"Hi there,
The email address associated to your {0} account was recently
The email address associated to your {0} account was recently
changed from _{1}_ to _{2}_.
Thanks,
Expand Down Expand Up @@ -288,7 +290,7 @@ public void SendPackageOwnerRequest(User fromUser, User toUser, PackageRegistrat

const string subject = "[{0}] The user '{1}' wants to add you as an owner of the package '{2}'.";

string body = @"The user '{0}' wants to add you as an owner of the package '{1}'.
string body = @"The user '{0}' wants to add you as an owner of the package '{1}'.
If you do not want to be listed as an owner of this package, simply delete this email.
To accept this request and become a listed owner of the package, click the following URL:
Expand Down
8 changes: 5 additions & 3 deletions src/NuGetGallery/Services/ReportPackageRequest.cs
Expand Up @@ -15,6 +15,7 @@ public class ReportPackageRequest
public User RequestingUser { get; set; }
public Package Package { get; set; }
public string Reason { get; set; }
public string Signature { get; set; }
public string Message { get; set; }
public bool AlreadyContactedOwners { get; set; }
public UrlHelper Url { get; set; }
Expand All @@ -24,16 +25,16 @@ internal string FillIn(string subject, IAppConfiguration config)
{
// note, format blocks {xxx} are matched by ordinal-case-sensitive comparison
var builder = new StringBuilder(subject);

Substitute(builder, "{GalleryOwnerName}", config.GalleryOwner.DisplayName);
Substitute(builder, "{Id}", Package.PackageRegistration.Id);
Substitute(builder, "{Version}", Package.Version);
Substitute(builder, "{Reason}", Reason);
if (RequestingUser != null)
{
Substitute(builder, "{User}", String.Format(
CultureInfo.CurrentCulture,
"{2}**User:** {0} ({1}){2}{3}",
CultureInfo.CurrentCulture,
"{2}**User:** {0} ({1}){2}{3}",
RequestingUser.Username,
RequestingUser.EmailAddress,
Environment.NewLine,
Expand All @@ -49,6 +50,7 @@ internal string FillIn(string subject, IAppConfiguration config)
Substitute(builder, "{PackageUrl}", Url.Package(Package.PackageRegistration.Id, null, scheme: "http"));
Substitute(builder, "{VersionUrl}", Url.Package(Package.PackageRegistration.Id, Package.Version, scheme: "http"));
Substitute(builder, "{Reason}", Reason);
Substitute(builder, "{Signature}", Signature);
Substitute(builder, "{Message}", Message);

builder.Replace(@"\{\", "{");
Expand Down
5 changes: 5 additions & 0 deletions src/NuGetGallery/ViewModels/ReportAbuseViewModel.cs
Expand Up @@ -40,6 +40,11 @@ public class ReportAbuseViewModel
ErrorMessage = "This doesn't appear to be a valid email address.")]
public string Email { get; set; }

[Required(ErrorMessage = "Please sign using your name.")]
[StringLength(1000)]
[Display(Name = "Signature")]
public string Signature { get; set; }

public bool ConfirmedUser { get; set; }

public IEnumerable<ReportPackageReason> ReasonChoices { get; set; }
Expand Down
40 changes: 31 additions & 9 deletions src/NuGetGallery/Views/Packages/ReportAbuse.cshtml
Expand Up @@ -9,18 +9,21 @@

<p class="message">
<strong>Important: Please do not use this form to report a bug in a package you are using!</strong><br />
This form is for reporting <em>abusive</em> packages such as
packages containing <em>malicious code</em> or spam. If "@Model.PackageId" simply doesn't
work, or if you need help getting the package installed, please
<a href="@Url.Action(actionName: "ContactOwners", controllerName: "Packages", routeValues: new { id = Model.PackageId })" title="contact the owners">contact the owners instead.</a>
This form is for reporting <em>abusive</em> packages such as
packages containing <em>malicious code</em> or spam. If "@Model.PackageId" simply doesn't
work, or if you need help getting the package installed, please
<a href="@Url.Action(actionName: "ContactOwners", controllerName: "Packages", routeValues: new { id = Model.PackageId })" title="contact the owners">contact the owners instead.</a>
</p>

<p>Please provide a detailed abuse report. Include exactly what the package did, for example if you are reporting a package with a virus or malicious code,
<em>please provide evidence to support your claim!</em> We cannot delete packages without evidence that they exhibit malicious behavior.</p>
<p>
Please provide a detailed abuse report. Include exactly what the package did, for example if you are reporting a package with a virus or malicious code,
<em>please provide evidence to support your claim!</em> We cannot delete packages without evidence that they exhibit malicious behavior.
</p>

@if (!Model.ConfirmedUser)
{
<p>Note: if you are the owner of @Model.PackageId, please
<p>
Note: if you are the owner of @Model.PackageId, please
<a href="@Url.LogOn(returnUrl)">sign in now before you complete this form.</a>
</p>
}
Expand Down Expand Up @@ -54,18 +57,37 @@
new Dictionary<string, object>
{
{ "style", "display: inline" },
})<br/>
})<br />
</div>
<div class="form-field">
@Html.LabelFor(m => m.Message, "Abuse Report")
<p>In addition to selecting the reason for reporting the package, you must provide details of the problem here.</p>
@Html.TextAreaFor(m => m.Message, 10, 50, null)
@Html.ValidationMessageFor(m => m.Message, null, new { id = "report-abuse-message" })
</div>
<div class="form-field" >
<div class="form-field">
@Html.CheckBoxFor(m => m.CopySender)
@Html.LabelFor(m => m.CopySender, new { @class = "checkbox" })
</div>
<div class="form-field">
<br /><span style="color: red">*</span> Required Statements for infringement claims<br /><br />
<strong>Good Faith Belief:</strong><br />
<p>
By typing my name (electronic signature), I have a good faith belief that the use of the material is not authorized by the intellectual property owner, its agent, or the law (e.g., it is not fair use).
</p>
<strong>Authority to Act:</strong>
<p>
I represent that the information in the notification is accurate, and under penalty of perjury, that I am authorized to act on behalf of the owner of an exclusive right that is allegedly infringed.
</p>
<strong>512(f) Acknowledgement:</strong>
<p>
As applicable under 17 U.S.C. 512(f), I acknowledge that I may be subject to liability for damages if I knowingly materially misrepresent that material or activity is infringing.
</p>
@Html.LabelFor(m => m.Signature)
@Html.EditorFor(m => m.Signature)
<span class="field-hint-message">Sign with your real name.</span>
@Html.ValidationMessageFor(m => m.Signature)
</div>
<img src="@Url.Content("~/Content/images/required.png")" alt="Blue border on left means required." />
@Html.SpamPreventionFields()
<input id="form-submit" type="submit" value="Report" title="Report '@Model.PackageId' for abuse" />
Expand Down

0 comments on commit a0ff162

Please sign in to comment.