From d50bd8054da56803b8e229e1fcc97d062dcaee84 Mon Sep 17 00:00:00 2001 From: Hamid Reza Mohammadi Date: Fri, 12 Mar 2021 10:39:16 +0330 Subject: [PATCH] #85 changing moderation api from DELETE to POST --- RMuseum/Controllers/GanjoorController.cs | 6 +++--- RMuseum/Services/Implementation/GanjoorService.cs | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/RMuseum/Controllers/GanjoorController.cs b/RMuseum/Controllers/GanjoorController.cs index 67ed785a..efe36f83 100644 --- a/RMuseum/Controllers/GanjoorController.cs +++ b/RMuseum/Controllers/GanjoorController.cs @@ -629,13 +629,13 @@ namespace RMuseum.Controllers /// /// /// - [HttpDelete] - [Route("comment/moderate")] + [HttpPost] + [Route("comment/moderate/{id}")] [Authorize(Policy = RMuseumSecurableItem.GanjoorEntityShortName + ":" + RMuseumSecurableItem.ModerateOperationShortName)] [ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))] [ProducesResponseType((int)HttpStatusCode.NotFound)] [ProducesResponseType((int)HttpStatusCode.Forbidden)] - public async Task DeleteModerateComment(int id, string reason) + public async Task DeleteModerateComment(int id, [FromBody]string reason) { var res = diff --git a/RMuseum/Services/Implementation/GanjoorService.cs b/RMuseum/Services/Implementation/GanjoorService.cs index 620e4bc4..ea8e4720 100644 --- a/RMuseum/Services/Implementation/GanjoorService.cs +++ b/RMuseum/Services/Implementation/GanjoorService.cs @@ -606,11 +606,12 @@ namespace RMuseum.Services.Implementation if (comment.UserId != null) { + reason = string.IsNullOrEmpty(reason) ? "" : $"علت ارائه شده برای حذف یا متن گزارش کاربر شاکی: {Environment.NewLine}" + + $"{reason} {Environment.NewLine}"; await _notificationService.PushNotification((Guid)comment.UserId, "حذف حاشیهٔ شما", $"حاشیهٔ شما به دلیل ناسازگاری با قوانین حاشیه‌گذاری گنجور و طبق گزارشات دیگر کاربران حذف شده است..{Environment.NewLine}" + - $"علت ارائه شده برای حذف: {Environment.NewLine}" + - $"{reason} {Environment.NewLine}" + + $"{reason}" + $"این متن حاشیهٔ حذف شدهٔ شماست: {Environment.NewLine}" + $"{comment.HtmlComment}" );