Show a News empty state on Home instead of hiding the card

Previously the whole "Club news" card just vanished when there was
nothing to show, dropping the "All news" link along with it. Now it
always renders -- either the real teaser or a "No news yet" card, still
linking through to mobile:news_list either way.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ECGMEwrc2k4D8VQuwjstj9
This commit is contained in:
2026-08-21 16:09:15 +02:00
parent 5096d0ba05
commit 40bee9af48
2 changed files with 22 additions and 9 deletions

View File

@@ -326,6 +326,15 @@ class HomeViewTests(TestCase):
self.assertEqual(list(response.context["news_items"]), [])
def test_news_card_shows_an_empty_state_with_a_link_to_all_news_when_there_is_none(self):
self.client.force_login(self.user)
response = self._get("home")
self.assertEqual(list(response.context["news_items"]), [])
self.assertContains(response, "No news yet.")
self.assertContains(response, 'href="/app/news/"')
def test_empty_account_gets_a_graceful_empty_state(self):
bare_user = User.objects.create_user(email="new@example.com", password="pw-secret-123")
self.client.force_login(bare_user)