Skip to content

Commit

Permalink
#527: ignore report with no notes
Browse files Browse the repository at this point in the history
  • Loading branch information
riipah committed Nov 20, 2019
1 parent c9841c2 commit 4ba2197
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions VocaDbModel/Database/Queries/UserQueries.cs
Expand Up @@ -521,6 +521,11 @@ class CachedUserStats {

PermissionContext.VerifyPermission(PermissionToken.ReportUser);

if (string.IsNullOrEmpty(notes)) {
log.Error("Notes are required");
return (false, 0);
}

return repository.HandleTransaction(ctx => {
var user = ctx.Load(userId);
Expand Down
3 changes: 2 additions & 1 deletion VocaDbWeb/Scripts/User/Details.ts
@@ -1,4 +1,4 @@
import rep = vdb.repositories;
import rep = vdb.repositories;

function initPage(confirmDisableStr: string) {

Expand All @@ -7,6 +7,7 @@ function initPage(confirmDisableStr: string) {
$("#composeMessageLink").button({ icons: { primary: 'ui-icon-mail-closed' } });
$("#editUserLink").button({ icons: { primary: 'ui-icon-wrench' } });
$("#disableUserLink").button({ icons: { primary: 'ui-icon-close' } });
$("#reportUserLink").button({ icons: { primary: 'ui-icon-close' } });
$("#setToLimitedLink").button({ icons: { primary: 'ui-icon-close' } });
$("#avatar").tooltip(<any>{ placement: "bottom" });

Expand Down
3 changes: 2 additions & 1 deletion VocaDbWeb/Views/User/Details.cshtml
Expand Up @@ -72,7 +72,7 @@
}
@if (Login.Manager.HasPermission(PermissionToken.ReportUser) && UserContext.LoggedUserId != Model.Id && Model.GroupId <= UserGroupId.Trusted && Model.Active) {
@Html.Raw("&nbsp;")
<a href="" id="reportUser" data-bind="click: function() { reportUserViewModel.show(); }">@Res.ReportSpamming</a>
<a href="" id="reportUserLink" data-bind="click: function() { reportUserViewModel.show(); }">@Res.ReportSpamming</a>
}
@if (Login.Manager.HasPermission(PermissionToken.RemoveEditPermission) && UserContext.LoggedUserId != Model.Id && Model.GroupId != UserGroupId.Limited && Model.Active && EntryPermissionManager.CanEditUser(Login.Manager, Model.GroupId)) {
@Html.Raw("&nbsp;")
Expand Down Expand Up @@ -419,6 +419,7 @@
}

@EntryDetailsHelpers.EntryDeletePopupBase("Please confirm that you wish to remove user's editing permissions. You may provide additional explanation below (optional).", "limitedUserViewModel", "setToLimitedLink", "Remove editing permissions", "Confirm")
@EntryDetailsHelpers.EntryDeletePopupBase("Please confirm that you wish to report user. Please provide additional explanation below.", "reportUserViewModel", "reportUserLink", "Report user", "Confirm")

@section Head {
@Styles.Render("~/Scripts/jqwidgets27/styles/css")
Expand Down

0 comments on commit 4ba2197

Please sign in to comment.