Skip to content

Commit c6a9cfa

Browse files
authored
Remove chatbot link and related access logic from home page (#1714)
* Remove chatbot link and related access logic from home page Eliminated the chatbot link from the home page template and removed associated access logic from the HomeView. Corresponding tests for chatbot link visibility were also deleted, simplifying the code and UI. * Remove Chatbot link from trial page Eliminates the Chatbot navigation link for SaaS deployments from the trial.html template. This may be due to a change in feature availability or access requirements.
1 parent 6e4f4dd commit c6a9cfa

File tree

4 files changed

+0
-55
lines changed

4 files changed

+0
-55
lines changed

ansible_ai_connect/main/tests/test_views.py

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -318,48 +318,6 @@ def tearDown(self):
318318
self.non_rh_user_with_subscription.delete()
319319
Organization.objects.filter(id=12345).delete()
320320

321-
def test_chatbot_link_with_anonymous_user(self):
322-
r = self.client.get(reverse("home"))
323-
self.assertEqual(r.status_code, HTTPStatus.OK)
324-
self.assertContains(r, TestChatbotView.DOCUMENT_URL)
325-
self.assertNotContains(r, "Chatbot")
326-
327-
def test_chatbot_link_with_non_rh_user_and_subscription(self):
328-
self.client.force_login(user=self.non_rh_user_with_subscription)
329-
r = self.client.get(reverse("home"))
330-
self.assertEqual(r.status_code, HTTPStatus.OK)
331-
self.assertContains(r, TestChatbotView.DOCUMENT_URL)
332-
self.assertContains(r, "Chatbot")
333-
334-
def test_chatbot_link_with_non_rh_user(self):
335-
self.client.force_login(user=self.non_rh_user)
336-
r = self.client.get(reverse("home"))
337-
self.assertEqual(r.status_code, HTTPStatus.OK)
338-
self.assertContains(r, TestChatbotView.DOCUMENT_URL)
339-
self.assertNotContains(r, "Chatbot")
340-
341-
def test_chatbot_link_with_non_rh_test_user(self):
342-
self.client.force_login(user=self.non_rh_test_user)
343-
r = self.client.get(reverse("home"))
344-
self.assertEqual(r.status_code, HTTPStatus.OK)
345-
self.assertContains(r, TestChatbotView.DOCUMENT_URL)
346-
self.assertContains(r, "Chatbot")
347-
348-
@override_settings(CHATBOT_DEFAULT_PROVIDER="")
349-
def test_chatbot_link_with_rh_user_but_chatbot_disabled(self):
350-
self.client.force_login(user=self.rh_user)
351-
r = self.client.get(reverse("home"))
352-
self.assertEqual(r.status_code, HTTPStatus.OK)
353-
self.assertContains(r, TestChatbotView.DOCUMENT_URL)
354-
self.assertNotContains(r, "Chatbot")
355-
356-
def test_chatbot_link_with_rh_user(self):
357-
self.client.force_login(user=self.rh_user)
358-
r = self.client.get(reverse("home"))
359-
self.assertEqual(r.status_code, HTTPStatus.OK)
360-
self.assertContains(r, TestChatbotView.DOCUMENT_URL)
361-
self.assertContains(r, "Chatbot")
362-
363321
def test_chatbot_view_with_anonymous_user(self):
364322
r = self.client.get(reverse("chatbot"))
365323
self.assertEqual(r.status_code, HTTPStatus.FOUND)

ansible_ai_connect/users/templates/users/home.html

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,6 @@ <h1 class="pf-c-title pf-m-lg">{{ project_name }}</h1>
131131
{% if deployment_mode == 'saas' and user.is_authenticated and user.rh_user_is_org_admin %}
132132
<a class="pf-l-level__item" href="/console"><span class="fas fa-solid fa-cog"></span> Admin Portal</a>
133133
{% endif %}
134-
{% if chatbot_enabled and deployment_mode == 'saas' and user.is_authenticated and can_access_chatbot %}
135-
<a class="pf-l-level__item" href="/chatbot"><span class="fas fa-solid fa-comments"></span> Chatbot</a>
136-
{% endif %}
137134
</div>
138135
</div>
139136
</div>

ansible_ai_connect/users/templates/users/trial.html

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,6 @@ <h1 class="pf-c-title pf-m-lg">{{ project_name }}</h1>
143143
{% if deployment_mode == 'saas' and user.is_authenticated and user.rh_user_is_org_admin %}
144144
<a class="pf-l-level__item" href="/console"><span class="fas fa-solid fa-cog"></span> Admin Portal</a>
145145
{% endif %}
146-
{% if chatbot_enabled and deployment_mode == 'saas' and user.is_authenticated and rh_internal_user_or_test_user %}
147-
<a class="pf-l-level__item" href="/chatbot"><span class="fas fa-solid fa-comments"></span> Chatbot</a>
148-
{% endif %}
149146
</div>
150147
</div>
151148
</div>

ansible_ai_connect/users/views.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,6 @@ def get_context_data(self, **kwargs):
112112

113113
context["documentation_url"] = settings.COMMERCIAL_DOCUMENTATION_URL
114114

115-
user = self.request.user
116-
context["can_access_chatbot"] = user.is_authenticated and (
117-
user.rh_internal
118-
or user.groups.filter(name="test").exists()
119-
or user.rh_org_has_subscription
120-
)
121-
122115
# Show chatbot link when the chatbot service is configured.
123116
llm: ModelPipelineStreamingChatBot = apps.get_app_config("ai").get_model_pipeline(
124117
ModelPipelineStreamingChatBot

0 commit comments

Comments
 (0)