From a9593ec4b2ff53b742db8d56b72d86be1a540178 Mon Sep 17 00:00:00 2001 From: Nicholas Summers Date: Fri, 18 Oct 2024 10:33:55 -0400 Subject: [PATCH 1/3] Print section fix for additional user types --- .../src/components/layout/FormActions.jsx | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/services/ui-src/src/components/layout/FormActions.jsx b/services/ui-src/src/components/layout/FormActions.jsx index f63403fd0..cedb252ce 100644 --- a/services/ui-src/src/components/layout/FormActions.jsx +++ b/services/ui-src/src/components/layout/FormActions.jsx @@ -26,21 +26,28 @@ const FormActions = () => { let searchParams = ""; let sectionId = ""; - if (currentUser.role === AppRoles.CMS_ADMIN) { - const stateId = window.location.href.split("/")[5]; + const role = currentUser.role; + if ( + role !== AppRoles.CMS_ADMIN && + role !== AppRoles.INTERNAL_USER && + role !== AppRoles.HELP_DESK && + role !== AppRoles.CMS_APPROVER && + role !== AppRoles.CMS_USER + ) { searchParams = document.location.pathname .toString() - .replace(`views/sections/${stateId}/`, "") + .replace("/sections/", "") .replace(formYear + "/", ""); - sectionId = formYear + "-" + searchParams.substring(1, 3); + sectionId = formYear + "-" + searchParams.substring(0, 2); } else { + const stateId = window.location.href.split("/")[5]; searchParams = document.location.pathname .toString() - .replace("/sections/", "") + .replace(`views/sections/${stateId}/`, "") .replace(formYear + "/", ""); - sectionId = formYear + "-" + searchParams.substring(0, 2); + sectionId = formYear + "-" + searchParams.substring(1, 3); } let subsectionId = sectionId + "-"; From b6b1c5f7fa5c6d8f13cd307360476ae0dbeffe24 Mon Sep 17 00:00:00 2001 From: Nick Summers Date: Tue, 22 Oct 2024 11:24:11 -0400 Subject: [PATCH 2/3] Garrett suggestion for smaller if --- services/ui-src/src/components/layout/FormActions.jsx | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/services/ui-src/src/components/layout/FormActions.jsx b/services/ui-src/src/components/layout/FormActions.jsx index cedb252ce..7d91b4946 100644 --- a/services/ui-src/src/components/layout/FormActions.jsx +++ b/services/ui-src/src/components/layout/FormActions.jsx @@ -27,13 +27,7 @@ const FormActions = () => { let sectionId = ""; const role = currentUser.role; - if ( - role !== AppRoles.CMS_ADMIN && - role !== AppRoles.INTERNAL_USER && - role !== AppRoles.HELP_DESK && - role !== AppRoles.CMS_APPROVER && - role !== AppRoles.CMS_USER - ) { + if (role == AppRoles.STATE_USER ) { searchParams = document.location.pathname .toString() .replace("/sections/", "") From 8f19f49f1cbee3add53770babe742970c653f117 Mon Sep 17 00:00:00 2001 From: Nicholas Summers Date: Fri, 25 Oct 2024 10:13:35 -0400 Subject: [PATCH 3/3] linting --- services/ui-src/src/components/layout/FormActions.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/ui-src/src/components/layout/FormActions.jsx b/services/ui-src/src/components/layout/FormActions.jsx index 7d91b4946..24431edd9 100644 --- a/services/ui-src/src/components/layout/FormActions.jsx +++ b/services/ui-src/src/components/layout/FormActions.jsx @@ -27,7 +27,7 @@ const FormActions = () => { let sectionId = ""; const role = currentUser.role; - if (role == AppRoles.STATE_USER ) { + if (role == AppRoles.STATE_USER) { searchParams = document.location.pathname .toString() .replace("/sections/", "")