From 6a18b1be587dc42042bd49df250e448127d5be6b Mon Sep 17 00:00:00 2001 From: James Kolpack Date: Tue, 21 Jul 2020 21:30:33 -0400 Subject: [PATCH] Default to user only data on search page --- WebCms/Controllers/ResultsController.cs | 5 +++++ WebCms/Models/LeafDataQuery.cs | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/WebCms/Controllers/ResultsController.cs b/WebCms/Controllers/ResultsController.cs index 7ab30c1..eaf98aa 100644 --- a/WebCms/Controllers/ResultsController.cs +++ b/WebCms/Controllers/ResultsController.cs @@ -14,6 +14,9 @@ namespace LeafWeb.WebCms.Controllers [MemberAuthorize(AllowGroup = "Authenticated")] public ActionResult Index(LeafDataQuery query) { + if (!query.HasParameters && !TempData.ContainsKey("Posted")) + query.usr = true; + var resultItems = DataService.GetLeafInputsOrdered(); @@ -39,6 +42,8 @@ namespace LeafWeb.WebCms.Controllers return CurrentUmbracoPage(); } + TempData["Posted"] = true; + return RedirectToCurrentUmbracoPage(query.GetNameValueCollection()); } diff --git a/WebCms/Models/LeafDataQuery.cs b/WebCms/Models/LeafDataQuery.cs index ce10f47..e5e4f89 100644 --- a/WebCms/Models/LeafDataQuery.cs +++ b/WebCms/Models/LeafDataQuery.cs @@ -76,5 +76,10 @@ namespace LeafWeb.WebCms.Models && string.IsNullOrEmpty(phips2) && !compl ); + + public bool HasParameters => + HasExtendedParameters + || !string.IsNullOrEmpty(q) + || usr; } } \ No newline at end of file