Skip to content

Commit

Permalink
Merge pull request #3094 from cisagov/bob/2899-suppress-blue-box
Browse files Browse the repository at this point in the history
#2899: don't show blue box when analyst clicks 'Manage Domain'
  • Loading branch information
dave-kennedy-ecs authored Nov 20, 2024
2 parents 3bba70c + 6a0c483 commit 5b7a667
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/registrar/templates/domain_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,16 @@ <h2 class="text-bold text-primary-dark domain-name-wrap">{{ domain.name }}</h2>

{% include "includes/domain_dates.html" %}

{% if is_portfolio_user and not is_domain_manager %}
<div class="usa-alert usa-alert--info usa-alert--slim">
<div class="usa-alert__body">
<p class="usa-alert__text ">
You don't have access to manage {{domain.name}}. If you need to make updates, contact one of the listed domain managers.
</p>
{% if analyst_action != 'edit' or analyst_action_location != domain.pk %}
{% if is_portfolio_user and not is_domain_manager %}
<div class="usa-alert usa-alert--info usa-alert--slim">
<div class="usa-alert__body">
<p class="usa-alert__text ">
You don't have access to manage {{domain.name}}. If you need to make updates, contact one of the listed domain managers.
</p>
</div>
</div>
</div>
{% endif %}
{% endif %}


Expand Down
21 changes: 21 additions & 0 deletions src/registrar/tests/test_views_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,27 @@ def test_domain_detail_with_no_information_or_domain_request(self):
self.assertContains(detail_page, "noinformation.gov")
self.assertContains(detail_page, "Domain missing domain information")

def test_domain_detail_with_analyst_managing_domain(self):
"""Test that domain management page returns 200 and does not display
blue error message when an analyst is managing the domain"""
with less_console_noise():
staff_user = create_user()
self.client.force_login(staff_user)

# need to set the analyst_action and analyst_action_location
# in the session to emulate user clicking Manage Domain
# in the admin interface
session = self.client.session
session["analyst_action"] = "edit"
session["analyst_action_location"] = self.domain.id
session.save()

detail_page = self.client.get(reverse("domain", kwargs={"pk": self.domain.id}))

self.assertNotContains(
detail_page, "To manage information for this domain, you must add yourself as a domain manager."
)

@less_console_noise_decorator
@override_flag("organization_feature", active=True)
def test_domain_readonly_on_detail_page(self):
Expand Down

0 comments on commit 5b7a667

Please sign in to comment.