From 3053b71c513b4aa659cda720b582b4c906db10a5 Mon Sep 17 00:00:00 2001 From: colin-lamed <9568290+colin-lamed@users.noreply.github.com> Date: Thu, 4 Jul 2024 16:24:20 +0100 Subject: [PATCH] BDOG-3170 Fix servicename on url search results --- .../hmrc/cataloguefrontend/SearchByUrlController.scala | 8 +++----- .../cataloguefrontend/view/SearchByUrlPage.scala.html | 8 ++++---- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/app/uk/gov/hmrc/cataloguefrontend/SearchByUrlController.scala b/app/uk/gov/hmrc/cataloguefrontend/SearchByUrlController.scala index d88a6bbf5..af2af1ab9 100644 --- a/app/uk/gov/hmrc/cataloguefrontend/SearchByUrlController.scala +++ b/app/uk/gov/hmrc/cataloguefrontend/SearchByUrlController.scala @@ -38,11 +38,9 @@ class SearchByUrlController @Inject() ( ) extends FrontendController(mcc) with CatalogueAuthBuilders: - private val serviceNameToUrl = routes.CatalogueController.service - def searchLanding: Action[AnyContent] = BasicAuthAction.async { implicit request => - Future.successful(Ok(searchByUrlPage(UrlSearchFilter.form, Nil, serviceNameToUrl))) + Future.successful(Ok(searchByUrlPage(UrlSearchFilter.form, Nil))) } def searchUrl = @@ -50,11 +48,11 @@ class SearchByUrlController @Inject() ( UrlSearchFilter.form .bindFromRequest() .fold( - formWithErrors => Future.successful(Ok(searchByUrlPage(formWithErrors, Nil, serviceNameToUrl))), + formWithErrors => Future.successful(Ok(searchByUrlPage(formWithErrors, Nil))), query => searchByUrlService .search(query.name) .map: results => - Ok(searchByUrlPage(UrlSearchFilter.form.bindFromRequest(), results, serviceNameToUrl)) + Ok(searchByUrlPage(UrlSearchFilter.form.bindFromRequest(), results)) ) } diff --git a/app/uk/gov/hmrc/cataloguefrontend/view/SearchByUrlPage.scala.html b/app/uk/gov/hmrc/cataloguefrontend/view/SearchByUrlPage.scala.html index a21987cb3..98154d625 100644 --- a/app/uk/gov/hmrc/cataloguefrontend/view/SearchByUrlPage.scala.html +++ b/app/uk/gov/hmrc/cataloguefrontend/view/SearchByUrlPage.scala.html @@ -15,13 +15,13 @@ *@ @import play.api.mvc.Call +@import uk.gov.hmrc.cataloguefrontend.{routes => appRoutes} @import uk.gov.hmrc.cataloguefrontend.service.SearchByUrlService.FrontendRoutes @this() @(form : Form[?], - searchResults : Seq[FrontendRoutes], - serviceNameToUrl: ServiceName => Call + searchResults : Seq[FrontendRoutes] )(implicit request : RequestHeader ) @@ -64,7 +64,7 @@

Search for a service by
-
+ @csrfFormField
@@ -86,7 +86,7 @@

Search for a service by @for(route <- result.routes) { - @result.service + @result.service.asString @if(route.isRegex) {