diff --git a/src/registrar/views/domain.py b/src/registrar/views/domain.py index 04eab1383..e54ec9c8f 100644 --- a/src/registrar/views/domain.py +++ b/src/registrar/views/domain.py @@ -174,16 +174,20 @@ class DomainFormBaseView(DomainBaseView, FormMixin): } is_analyst_action = ("analyst_action" in self.session and "analyst_action_location" in self.session) + should_notify=False - if form.__class__ in form_label_dict and not is_analyst_action: - # these types of forms can cause notifications - should_notify = True - if form.__class__ in check_for_portfolio: - # some forms shouldn't cause notifications if they are in a portfolio - info = self.get_domain_info_from_domain() - if not info or info.portfolio: - logger.debug("No notification sent: Domain is part of a portfolio") - should_notify = False + if form.__class__ in form_label_dict: + if is_analyst_action: + logger.debug("No notification sent: Action was conducted by an analyst") + else: + # these types of forms can cause notifications + should_notify = True + if form.__class__ in check_for_portfolio: + # some forms shouldn't cause notifications if they are in a portfolio + info = self.get_domain_info_from_domain() + if not info or info.portfolio: + logger.debug("No notification sent: Domain is part of a portfolio") + should_notify = False else: # don't notify for any other types of forms should_notify = False @@ -202,7 +206,7 @@ class DomainFormBaseView(DomainBaseView, FormMixin): ) else: logger.info( - f"Not notifying for {form.__class__}, form changes: {form.has_changed()}, force_send: {force_send}" + f"No notification sent for {form.__class__}. form changes: {form.has_changed()}, force_send: {force_send}" ) def email_domain_managers(self, domain: Domain, template: str, subject_template: str, context={}):