From 53ea0c2cc68cd665fc46fa73596c4a43c78da5e6 Mon Sep 17 00:00:00 2001 From: Erin Song <121973038+erinysong@users.noreply.github.com> Date: Thu, 10 Apr 2025 00:07:51 -0700 Subject: [PATCH 1/5] Allow making subsequent requests in org model --- src/registrar/views/domain_request.py | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/src/registrar/views/domain_request.py b/src/registrar/views/domain_request.py index f6fac176d..80fa96dd1 100644 --- a/src/registrar/views/domain_request.py +++ b/src/registrar/views/domain_request.py @@ -326,7 +326,7 @@ class DomainRequestWizard(TemplateView): # if pending requests exist and user does not have approved domains, # present message that domain request cannot be submitted pending_requests = self.pending_requests() - if len(pending_requests) > 0: + if len(pending_requests) > 0 and not flag_is_active_for_user(self.request.user, "organization_feature"): message_header = "You cannot submit this request yet" message_content = ( f"

{message_header}

" @@ -625,11 +625,6 @@ class PortfolioAdditionalDetails(DomainRequestWizard): 2: FEBAnythingElseYesNoForm 3: PortfolioAnythingElseForm """ - if not self.requires_feb_questions(): - for i in range(3): - forms[i].mark_form_for_deletion() - # If FEB questions aren't required, validate only the anything else form - return forms[3].is_valid() eop_forms_valid = True if not forms[0].is_valid(): # If the user isn't working with EOP, don't validate the EOP contact form @@ -797,11 +792,11 @@ class Purpose(DomainRequestWizard): option = feb_purpose_options_form.cleaned_data.get("feb_purpose_choice") if option == "new": purpose_details_form.fields["purpose"].error_messages = { - "required": "Provide details on why a new domain is required." + "required": "Explain why a new domain is required." } elif option == "redirect": purpose_details_form.fields["purpose"].error_messages = { - "required": "Provide details on why a redirect is necessary." + "required": "Explain why a redirect is needed." } elif option == "other": purpose_details_form.fields["purpose"].error_messages = { @@ -970,9 +965,6 @@ class Review(DomainRequestWizard): context["Step"] = self.get_step_enum().__members__ context["domain_request"] = self.domain_request context["requires_feb_questions"] = self.requires_feb_questions() - context["purpose_label"] = DomainRequest.FEBPurposeChoices.get_purpose_label( - self.domain_request.feb_purpose_choice - ) return context def goto_next_step(self): @@ -1186,10 +1178,6 @@ class PortfolioDomainRequestStatusViewOnly(DetailView): context["Step"] = PortfolioDomainRequestStep.__members__ context["steps"] = request_step_list(wizard, PortfolioDomainRequestStep) context["form_titles"] = wizard.titles - context["requires_feb_questions"] = self.object.is_feb() and flag_is_active_for_user( - self.request.user, "organization_feature" - ) - context["purpose_label"] = DomainRequest.FEBPurposeChoices.get_purpose_label(self.object.feb_purpose_choice) return context From e9cf5fc8840c4f7a3f1a474932862ad4b9cd1f58 Mon Sep 17 00:00:00 2001 From: Erin Song <121973038+erinysong@users.noreply.github.com> Date: Thu, 10 Apr 2025 00:23:34 -0700 Subject: [PATCH 2/5] Resolve paths with main --- src/registrar/views/domain_request.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/registrar/views/domain_request.py b/src/registrar/views/domain_request.py index 80fa96dd1..6b9e8c4a4 100644 --- a/src/registrar/views/domain_request.py +++ b/src/registrar/views/domain_request.py @@ -625,6 +625,11 @@ class PortfolioAdditionalDetails(DomainRequestWizard): 2: FEBAnythingElseYesNoForm 3: PortfolioAnythingElseForm """ + if not self.requires_feb_questions(): + for i in range(3): + forms[i].mark_form_for_deletion() + # If FEB questions aren't required, validate only the anything else form + return forms[3].is_valid() eop_forms_valid = True if not forms[0].is_valid(): # If the user isn't working with EOP, don't validate the EOP contact form @@ -792,11 +797,11 @@ class Purpose(DomainRequestWizard): option = feb_purpose_options_form.cleaned_data.get("feb_purpose_choice") if option == "new": purpose_details_form.fields["purpose"].error_messages = { - "required": "Explain why a new domain is required." + "required": "Provide details on why a new domain is required." } elif option == "redirect": purpose_details_form.fields["purpose"].error_messages = { - "required": "Explain why a redirect is needed." + "required": "Provide details on why a redirect is necessary." } elif option == "other": purpose_details_form.fields["purpose"].error_messages = { @@ -965,6 +970,9 @@ class Review(DomainRequestWizard): context["Step"] = self.get_step_enum().__members__ context["domain_request"] = self.domain_request context["requires_feb_questions"] = self.requires_feb_questions() + context["purpose_label"] = DomainRequest.FEBPurposeChoices.get_purpose_label( + self.domain_request.feb_purpose_choice + ) return context def goto_next_step(self): @@ -1178,6 +1186,10 @@ class PortfolioDomainRequestStatusViewOnly(DetailView): context["Step"] = PortfolioDomainRequestStep.__members__ context["steps"] = request_step_list(wizard, PortfolioDomainRequestStep) context["form_titles"] = wizard.titles + context["requires_feb_questions"] = self.object.is_feb() and flag_is_active_for_user( + self.request.user, "organization_feature" + ) + context["purpose_label"] = DomainRequest.FEBPurposeChoices.get_purpose_label(self.object.feb_purpose_choice) return context From 0785880a7e32dcf4c1219c18fc10cc4259eccdc3 Mon Sep 17 00:00:00 2001 From: Erin <121973038+erinysong@users.noreply.github.com> Date: Tue, 15 Apr 2025 13:57:01 -0400 Subject: [PATCH 3/5] Add log to test on sandbox --- src/registrar/views/domain_request.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/registrar/views/domain_request.py b/src/registrar/views/domain_request.py index 6b9e8c4a4..3c8eb1f86 100644 --- a/src/registrar/views/domain_request.py +++ b/src/registrar/views/domain_request.py @@ -326,7 +326,8 @@ class DomainRequestWizard(TemplateView): # if pending requests exist and user does not have approved domains, # present message that domain request cannot be submitted pending_requests = self.pending_requests() - if len(pending_requests) > 0 and not flag_is_active_for_user(self.request.user, "organization_feature"): + if not flag_is_active_for_user(self.request.user, "organization_feature") and len(pending_requests) > 0: + logger.debug("flag is active for user %s: %s" % self.request.user, flag_is_active_for_user(self.request.user, "organization_feature")) message_header = "You cannot submit this request yet" message_content = ( f"

{message_header}

" From 71a3e549b7c619a9a6ce92ed80f9d836344b0c66 Mon Sep 17 00:00:00 2001 From: Erin <121973038+erinysong@users.noreply.github.com> Date: Tue, 15 Apr 2025 14:06:09 -0400 Subject: [PATCH 4/5] Remove test log --- src/registrar/views/domain_request.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/registrar/views/domain_request.py b/src/registrar/views/domain_request.py index 3c8eb1f86..be4d3b7ba 100644 --- a/src/registrar/views/domain_request.py +++ b/src/registrar/views/domain_request.py @@ -327,7 +327,6 @@ class DomainRequestWizard(TemplateView): # present message that domain request cannot be submitted pending_requests = self.pending_requests() if not flag_is_active_for_user(self.request.user, "organization_feature") and len(pending_requests) > 0: - logger.debug("flag is active for user %s: %s" % self.request.user, flag_is_active_for_user(self.request.user, "organization_feature")) message_header = "You cannot submit this request yet" message_content = ( f"

{message_header}

" From 1ea3dc0d1529b5075ca06e1368e3db7de2ea54e7 Mon Sep 17 00:00:00 2001 From: Erin <121973038+erinysong@users.noreply.github.com> Date: Wed, 16 Apr 2025 15:36:15 -0400 Subject: [PATCH 5/5] Check that active user is org member when adding subsequent request --- src/registrar/views/domain_request.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/registrar/views/domain_request.py b/src/registrar/views/domain_request.py index be4d3b7ba..e17495bcb 100644 --- a/src/registrar/views/domain_request.py +++ b/src/registrar/views/domain_request.py @@ -23,6 +23,7 @@ from registrar.models.user import User from registrar.utility.waffle import flag_is_active_for_user from registrar.views.utility import StepsHelper from registrar.utility.enums import Step, PortfolioDomainRequestStep +from registrar.views.utility.invitation_helper import get_org_membership logger = logging.getLogger(__name__) @@ -326,7 +327,9 @@ class DomainRequestWizard(TemplateView): # if pending requests exist and user does not have approved domains, # present message that domain request cannot be submitted pending_requests = self.pending_requests() - if not flag_is_active_for_user(self.request.user, "organization_feature") and len(pending_requests) > 0: + portfolio = self.request.session.get("portfolio") + _, member_of_this_org = get_org_membership(portfolio, self.request.user.email, self.request.user) + if not member_of_this_org and len(pending_requests) > 0: message_header = "You cannot submit this request yet" message_content = ( f"

{message_header}

"