diff --git a/src/Orchard.Web/Packages/Orchard.Comments/Controllers/AdminController.cs b/src/Orchard.Web/Packages/Orchard.Comments/Controllers/AdminController.cs index f16fcee96..f7daca95d 100644 --- a/src/Orchard.Web/Packages/Orchard.Comments/Controllers/AdminController.cs +++ b/src/Orchard.Web/Packages/Orchard.Comments/Controllers/AdminController.cs @@ -228,6 +228,9 @@ namespace Orchard.Comments.Controllers { } catch (Exception exception) { _notifier.Error(T("Closing Comments failed: " + exception.Message)); + if (!String.IsNullOrEmpty(returnUrl)) { + return Redirect(returnUrl); + } return RedirectToAction("Index"); } } @@ -244,6 +247,9 @@ namespace Orchard.Comments.Controllers { } catch (Exception exception) { _notifier.Error(T("Enabling Comments failed: " + exception.Message)); + if (!String.IsNullOrEmpty(returnUrl)) { + return Redirect(returnUrl); + } return RedirectToAction("Index"); } } @@ -285,16 +291,22 @@ namespace Orchard.Comments.Controllers { } } - public ActionResult Delete(int id) { + public ActionResult Delete(int id, string returnUrl) { try { if (!_authorizer.Authorize(Permissions.ModerateComment, T("Couldn't delete comment"))) return new HttpUnauthorizedResult(); int commentedOn = _commentService.GetComment(id).CommentedOn; _commentService.DeleteComment(id); + if (!String.IsNullOrEmpty(returnUrl)) { + return Redirect(returnUrl); + } return RedirectToAction("Details", new { id = commentedOn }); } catch (Exception exception) { _notifier.Error(T("Deleting comment failed: " + exception.Message)); + if (!String.IsNullOrEmpty(returnUrl)) { + return Redirect(returnUrl); + } return Index(new CommentIndexOptions()); } } diff --git a/src/Orchard.Web/Packages/Orchard.Comments/Views/Models/EditorTemplates/HasComments.ascx b/src/Orchard.Web/Packages/Orchard.Comments/Views/Models/EditorTemplates/HasComments.ascx index 79a4499d9..ed051654a 100644 --- a/src/Orchard.Web/Packages/Orchard.Comments/Views/Models/EditorTemplates/HasComments.ascx +++ b/src/Orchard.Web/Packages/Orchard.Comments/Views/Models/EditorTemplates/HasComments.ascx @@ -9,6 +9,9 @@