Skip to content

feat(chat): optional sidebar filters — only-conversations + by WhatsApp number - #497

Open
bambinounos wants to merge 1 commit into
shridarpatil:mainfrom
bambinounos:feat/optional-chat-filters
Open

feat(chat): optional sidebar filters — only-conversations + by WhatsApp number#497
bambinounos wants to merge 1 commit into
shridarpatil:mainfrom
bambinounos:feat/optional-chat-filters

Conversation

@bambinounos

Copy link
Copy Markdown
Contributor

What

Two opt-in filters in the chat sidebar's existing filter popover — both off by default, so the list behaves exactly as today unless the agent turns them on:

  • "Only conversations": hides contacts that have never exchanged a message (last_message_at IS NOT NULL). Useful after importing a contact base (CSV import): without it, hundreds of imported-but-silent contacts drown the sidebar for users with contacts:read.
  • "Filter by number": shows only contacts whose conversation belongs to one WhatsApp account (whatsapp_account = ?). The section only renders when the org has more than one account, so single-number deployments see no UI change.

The filter trigger shows an active-count badge, and both filters are wired into pagination/infinite scroll (fetchContacts + loadMoreContacts).

Implementation

  • internal/handlers/contacts.goListContacts accepts optional account and with_conversations query params (ignored when absent).
  • frontend/src/stores/contacts.tslistAccountFilter / onlyConversations state, passed through on list + load-more.
  • frontend/src/services/api.ts — params added to contacts.list.
  • frontend/src/views/chat/ChatView.vue — popover UI (toggle + per-account list with "All numbers"), active filter badge.
  • i18n keys (chat.onlyConversations / filterByNumber / allNumbers) for en/es/ar/hi/ta.

Testing

  • Filters off → responses byte-identical to current behavior (params omitted).
  • "Only conversations" hides imported contacts without messages; badge shows 1.
  • With 2 accounts: per-number filtering matches whatsapp_account; section hidden with a single account.
  • Running in production on a 2-number deployment with ~550 imported contacts.

Two opt-in filters in the chat sidebar filter popover:
- "Only conversations": hides contacts with no messages (e.g. imported
  contacts) via last_message_at IS NOT NULL.
- "Filter by number": shows only contacts tied to one WhatsApp account
  (shown only when there is more than one account) via whatsapp_account = ?.

Both default off, so the contact list behaves exactly as before. Backend
ListContacts gains optional `account` and `with_conversations` query params.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant