From adbab55ffc66992e5151b1c64999a67af152302d Mon Sep 17 00:00:00 2001 From: myates Date: Fri, 18 Sep 2015 16:35:36 +1000 Subject: [PATCH 1/2] Comment service now fetches latest (instead of published) when deleting a comment. --- .../Modules/Orchard.Comments/Services/CommentService.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Orchard.Web/Modules/Orchard.Comments/Services/CommentService.cs b/src/Orchard.Web/Modules/Orchard.Comments/Services/CommentService.cs index 32e75f229..fff55e5ed 100644 --- a/src/Orchard.Web/Modules/Orchard.Comments/Services/CommentService.cs +++ b/src/Orchard.Web/Modules/Orchard.Comments/Services/CommentService.cs @@ -120,7 +120,8 @@ namespace Orchard.Comments.Services { } public void DeleteComment(int commentId) { - _orchardServices.ContentManager.Remove(_orchardServices.ContentManager.Get(commentId).ContentItem); + // Get latest because the comment may be unpublished if the anti-spam module has caught it + _orchardServices.ContentManager.Remove(_orchardServices.ContentManager.Get(commentId, VersionOptions.Latest)); } public bool CommentsDisabledForCommentedContent(int id) { From e6c042d1a0d810f53a9b474dcf4389bc46f9484c Mon Sep 17 00:00:00 2001 From: myates Date: Sat, 19 Sep 2015 22:00:37 +1000 Subject: [PATCH 2/2] Fix build error --- .../Modules/Orchard.Comments/Services/CommentService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Orchard.Web/Modules/Orchard.Comments/Services/CommentService.cs b/src/Orchard.Web/Modules/Orchard.Comments/Services/CommentService.cs index fff55e5ed..ab0265923 100644 --- a/src/Orchard.Web/Modules/Orchard.Comments/Services/CommentService.cs +++ b/src/Orchard.Web/Modules/Orchard.Comments/Services/CommentService.cs @@ -121,7 +121,7 @@ namespace Orchard.Comments.Services { public void DeleteComment(int commentId) { // Get latest because the comment may be unpublished if the anti-spam module has caught it - _orchardServices.ContentManager.Remove(_orchardServices.ContentManager.Get(commentId, VersionOptions.Latest)); + _orchardServices.ContentManager.Remove(_orchardServices.ContentManager.Get(commentId, VersionOptions.Latest).ContentItem); } public bool CommentsDisabledForCommentedContent(int id) {