diff --git a/src/Orchard.Specs/Comments.feature b/src/Orchard.Specs/Comments.feature
index 6051faccc..7c27734a3 100644
--- a/src/Orchard.Specs/Comments.feature
+++ b/src/Orchard.Specs/Comments.feature
@@ -43,21 +43,14 @@ Scenario: HTML markup in any given comment is encoded
Then I should see "This is<br id="bad-anon-br" />a <a href"
And I should not see "
"
-Scenario: Moderated comments are not displayed
- Given I have installed Orchard
- When I go to "admin/blogs/create"
+ # Moderated comments are not displayed
+ When I go to "users/account/logon"
And I fill in
| name | value |
- | Title.Title | My Blog |
- And I hit "Save"
- And I go to "admin/blogs"
- And I follow "My Blog"
- And I follow "New Post" where class name has "primaryAction"
- And I fill in
- | name | value |
- | Title.Title | My Post |
- | Body.Text | Hi there. |
- And I hit "Publish Now"
+ | userNameOrEmail | admin |
+ | password | 6655321 |
+ And I hit "Sign In"
+ And I am redirected
And I go to "admin/settings/comments"
And I fill in
| name | value |
diff --git a/src/Orchard.Specs/Comments.feature.cs b/src/Orchard.Specs/Comments.feature.cs
index bef778753..268618841 100644
--- a/src/Orchard.Specs/Comments.feature.cs
+++ b/src/Orchard.Specs/Comments.feature.cs
@@ -154,94 +154,66 @@ this.ScenarioSetup(scenarioInfo);
testRunner.Then("I should see \"This is<br id="bad-anon-br" />a <a href\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 44
testRunner.And("I should not see \"
\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line hidden
- this.ScenarioCleanup();
- }
-
- [NUnit.Framework.TestAttribute()]
- [NUnit.Framework.DescriptionAttribute("Moderated comments are not displayed")]
- public virtual void ModeratedCommentsAreNotDisplayed()
- {
- TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Moderated comments are not displayed", ((string[])(null)));
-#line 46
-this.ScenarioSetup(scenarioInfo);
#line 47
- testRunner.Given("I have installed Orchard", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given ");
-#line 48
- testRunner.When("I go to \"admin/blogs/create\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
+ testRunner.When("I go to \"users/account/logon\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
TechTalk.SpecFlow.Table table5 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table5.AddRow(new string[] {
- "Title.Title",
- "My Blog"});
-#line 49
+ "userNameOrEmail",
+ "admin"});
+ table5.AddRow(new string[] {
+ "password",
+ "6655321"});
+#line 48
testRunner.And("I fill in", ((string)(null)), table5, "And ");
#line 52
- testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+ testRunner.And("I hit \"Sign In\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 53
- testRunner.And("I go to \"admin/blogs\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+ testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 54
- testRunner.And("I follow \"My Blog\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 55
- testRunner.And("I follow \"New Post\" where class name has \"primaryAction\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+ testRunner.And("I go to \"admin/settings/comments\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line hidden
TechTalk.SpecFlow.Table table6 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table6.AddRow(new string[] {
- "Title.Title",
- "My Post"});
- table6.AddRow(new string[] {
- "Body.Text",
- "Hi there."});
-#line 56
- testRunner.And("I fill in", ((string)(null)), table6, "And ");
+ "CommentSettings.ModerateComments",
+ "true"});
+#line 55
+ testRunner.And("I fill in", ((string)(null)), table6, "And ");
+#line 58
+ testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+#line 59
+ testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 60
- testRunner.And("I hit \"Publish Now\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+ testRunner.Then("I should see \"Settings updated\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 61
- testRunner.And("I go to \"admin/settings/comments\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
+ testRunner.When("I go to \"users/account/logoff\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
+#line 62
+ testRunner.And("I go to \"my-blog/my-post\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line hidden
TechTalk.SpecFlow.Table table7 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table7.AddRow(new string[] {
- "CommentSettings.ModerateComments",
- "true"});
-#line 62
- testRunner.And("I fill in", ((string)(null)), table7, "And ");
-#line 65
- testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 66
- testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 67
- testRunner.Then("I should see \"Settings updated\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
-#line 68
- testRunner.When("I go to \"users/account/logoff\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
-#line 69
- testRunner.And("I go to \"my-blog/my-post\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line hidden
- TechTalk.SpecFlow.Table table8 = new TechTalk.SpecFlow.Table(new string[] {
- "name",
- "value"});
- table8.AddRow(new string[] {
"Comments.Author",
"Bill"});
- table8.AddRow(new string[] {
+ table7.AddRow(new string[] {
"Comments.CommentText",
"This is a moderated comment."});
-#line 70
- testRunner.And("I fill in", ((string)(null)), table8, "And ");
-#line 74
+#line 63
+ testRunner.And("I fill in", ((string)(null)), table7, "And ");
+#line 67
testRunner.And("I hit \"Submit Comment\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 75
+#line 68
testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 77
+#line 70
testRunner.And("I go to \"my-blog/my-post\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
-#line 78
+#line 71
testRunner.Then("I should see \"Hi there\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
-#line 79
+#line 72
testRunner.And("I should not see \"This is a moderated comment\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line hidden
this.ScenarioCleanup();
diff --git a/src/Orchard.Web/Modules/Orchard.OutputCache/Filters/OutputCacheFilter.cs b/src/Orchard.Web/Modules/Orchard.OutputCache/Filters/OutputCacheFilter.cs
index 1142909d0..a48d5bad1 100644
--- a/src/Orchard.Web/Modules/Orchard.OutputCache/Filters/OutputCacheFilter.cs
+++ b/src/Orchard.Web/Modules/Orchard.OutputCache/Filters/OutputCacheFilter.cs
@@ -95,6 +95,8 @@ namespace Orchard.OutputCache.Filters {
var controllerAttributes = filterContext.ActionDescriptor.ControllerDescriptor.GetCustomAttributes(typeof(OutputCacheAttribute), true);
var outputCacheAttribute = actionAttributes.Concat(controllerAttributes).Cast().FirstOrDefault();
+ _workContext = _workContextAccessor.GetContext();
+
if (outputCacheAttribute != null) {
if (outputCacheAttribute.Duration <= 0 || outputCacheAttribute.NoStore) {
Logger.Debug("Request ignored based on OutputCache attribute");
@@ -128,8 +130,6 @@ namespace Orchard.OutputCache.Filters {
return;
}
- _workContext = _workContextAccessor.GetContext();
-
// don't return any cached content, or cache any content, if the user is authenticated
if (_workContext.CurrentUser != null) {
Logger.Debug("Request ignored on Authenticated user");
@@ -290,19 +290,14 @@ namespace Orchard.OutputCache.Filters {
}
public void OnActionExecuted(ActionExecutedContext filterContext) {
- // this means the cache module is not applied in this context
- if (_workContext == null) {
- return;
- }
-
+
// handle redirections
_transformRedirect = TransformRedirect(filterContext);
}
public void OnResultExecuted(ResultExecutedContext filterContext) {
- // this means the cache module is not applied in this context
- if (_workContext == null) {
+ if (AdminFilter.IsApplied(new RequestContext(filterContext.HttpContext, new RouteData()))) {
return;
}
@@ -461,6 +456,10 @@ namespace Orchard.OutputCache.Filters {
throw new ArgumentNullException();
}
+ if (AdminFilter.IsApplied(new RequestContext(filterContext.HttpContext, new RouteData()))) {
+ return false;
+ }
+
var redirectResult = filterContext.Result as RedirectResult;
// status code can't be tested at this point, so test the result type instead
@@ -475,8 +474,7 @@ namespace Orchard.OutputCache.Filters {
if (!VirtualPathUtility.IsAbsolute(redirectUrl)) {
var applicationRoot = new UrlHelper(filterContext.HttpContext.Request.RequestContext).MakeAbsolute("/");
if (redirectUrl.StartsWith(applicationRoot, StringComparison.OrdinalIgnoreCase)) {
- redirectUrl = "~/" + redirectUrl.Substring(applicationRoot.Length);
- redirectUrl = VirtualPathUtility.ToAbsolute(redirectUrl);
+ redirectUrl = redirectUrl.Substring(applicationRoot.Length);
}
}