diff --git a/src/registrar/models/user.py b/src/registrar/models/user.py index b135e30c7..e7444d5ea 100644 --- a/src/registrar/models/user.py +++ b/src/registrar/models/user.py @@ -424,3 +424,8 @@ class User(AbstractUser): def is_org_user(self, request): has_organization_feature_flag = flag_is_active(request, "organization_feature") return has_organization_feature_flag and self.has_base_portfolio_permission() + + def user_domain_count(self): + """Returns the number of domains associated with this user through UserDomainRole""" + available_domains = UserDomainRole.objects.filter(user=self, domain__isnull=False) + return available_domains.count() diff --git a/src/registrar/templates/home.html b/src/registrar/templates/home.html index b79b69ebc..1392885e9 100644 --- a/src/registrar/templates/home.html +++ b/src/registrar/templates/home.html @@ -29,7 +29,7 @@
- {% include "includes/domains_table.html" %} + {% include "includes/domains_table.html" user_domain_count=user_domain_count %} {% include "includes/domain_requests_table.html" %} diff --git a/src/registrar/templates/includes/domains_table.html b/src/registrar/templates/includes/domains_table.html index 309702d26..f373f4459 100644 --- a/src/registrar/templates/includes/domains_table.html +++ b/src/registrar/templates/includes/domains_table.html @@ -35,6 +35,7 @@ + {% if user_domains_count and user_domains_count > 0 %} + {% endif %} {% if portfolio %} diff --git a/src/registrar/templates/portfolio_domains.html b/src/registrar/templates/portfolio_domains.html index ede7886e6..84bbc1cf6 100644 --- a/src/registrar/templates/portfolio_domains.html +++ b/src/registrar/templates/portfolio_domains.html @@ -6,5 +6,5 @@ {% block portfolio_content %}