ui: remove the double email counts (eye sore) (#126)

Drew Smirnoff created

Change summary

tui/inbox.go      | 12 ++++--------
tui/inbox_test.go | 36 ------------------------------------
2 files changed, 4 insertions(+), 44 deletions(-)

Detailed changes

tui/inbox.go 🔗

@@ -219,15 +219,15 @@ func (m *Inbox) updateList() {
 func (m *Inbox) getTitle() string {
 	var title string
 	if m.currentAccountID == "" {
-		title = m.getBaseTitleWithCount() + " - All Accounts"
+		title = m.getBaseTitle() + " - All Accounts"
 	} else {
-		title = m.getBaseTitleWithCount()
+		title = m.getBaseTitle()
 		for _, acc := range m.accounts {
 			if acc.ID == m.currentAccountID {
 				if acc.Name != "" {
-					title = fmt.Sprintf("%s - %s", m.getBaseTitleWithCount(), acc.Name)
+					title = fmt.Sprintf("%s - %s", m.getBaseTitle(), acc.Name)
 				} else {
-					title = fmt.Sprintf("%s - %s", m.getBaseTitleWithCount(), acc.Email)
+					title = fmt.Sprintf("%s - %s", m.getBaseTitle(), acc.Email)
 				}
 				break
 			}
@@ -251,10 +251,6 @@ func (m *Inbox) getBaseTitle() string {
 	}
 }
 
-func (m *Inbox) getBaseTitleWithCount() string {
-	return fmt.Sprintf("%s (%d)", m.getBaseTitle(), m.emailsCount)
-}
-
 func (m *Inbox) Init() tea.Cmd {
 	return nil
 }

tui/inbox_test.go 🔗

@@ -1,7 +1,6 @@
 package tui
 
 import (
-	"strings"
 	"testing"
 	"time"
 
@@ -272,41 +271,6 @@ func TestInboxGetEmailAtIndex(t *testing.T) {
 	}
 }
 
-func TestInboxTitleShowsCount(t *testing.T) {
-	accounts := []config.Account{
-		{ID: "account-1", Email: "test@example.com"},
-	}
-
-	emails := []fetcher.Email{
-		{UID: 1, From: "sender@example.com", Subject: "Email 1", AccountID: "account-1", Date: time.Now()},
-		{UID: 2, From: "sender@example.com", Subject: "Email 2", AccountID: "account-1", Date: time.Now().Add(-time.Minute)},
-		{UID: 3, From: "sender@example.com", Subject: "Email 3", AccountID: "account-1", Date: time.Now().Add(-2 * time.Minute)},
-	}
-
-	inbox := NewInbox(emails, accounts)
-
-	if !strings.Contains(inbox.list.Title, "Inbox (3)") {
-		t.Fatalf("expected inbox title to contain count, got %q", inbox.list.Title)
-	}
-}
-
-func TestSentInboxTitleShowsCount(t *testing.T) {
-	accounts := []config.Account{
-		{ID: "account-1", Email: "test@example.com"},
-	}
-
-	emails := []fetcher.Email{
-		{UID: 1, From: "sender@example.com", Subject: "Email 1", AccountID: "account-1", Date: time.Now()},
-		{UID: 2, From: "sender@example.com", Subject: "Email 2", AccountID: "account-1", Date: time.Now().Add(-time.Minute)},
-	}
-
-	inbox := NewSentInbox(emails, accounts)
-
-	if !strings.Contains(inbox.list.Title, "Sent (2)") {
-		t.Fatalf("expected sent title to contain count, got %q", inbox.list.Title)
-	}
-}
-
 func TestFetchMoreTriggeredAtListEnd(t *testing.T) {
 	accounts := []config.Account{
 		{ID: "account-1", Email: "test@example.com"},