fix(contacts): distinguish WhatsApp group contacts from real customer contacts (EVO-1018)#47
Merged
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideAdds explicit support for WhatsApp group contacts by extending the Contact types and list/search params, rendering a dedicated Group badge, normalizing groups to person in the editable form, and wiring up translations for the new type across all locales. Class diagram for updated contact types and componentsclassDiagram
class Contact {
+string id
+string name
+string type // person | company | group
+string email
+string phone_number
+string thumbnail
+ContactPipelineInfo pipeline
+string created_at
+string updated_at
}
class ContactsListParams {
+string search
+string sort
+string order // asc | desc
+string[] labels
+string q
+string type // person | company | group
+boolean include_groups
+string company_id
+boolean include_contact_inboxes
+string created_after
+string created_before
}
class ContactsSearchParams {
+number page
+number per_page
+string sort
+string type // person | company | group
+string[] labels
+boolean include_contact_inboxes
}
class ContactTypeBadge {
+string type // person | company | group
+string className
+renderBadge()
}
class ContactForm {
+Contact contact
+setFormData()
+normalizeType()
}
Contact "1" --> "*" ContactPipelineInfo : pipelineInfo
ContactForm --> Contact : uses
ContactForm --> ContactTypeBadge : renders
ContactTypeBadge --> ContactsTranslations : uses
ContactsListParams --> Contact : queries
ContactsSearchParams --> Contact : searches
class ContactsTranslations {
+string type_person
+string type_company
+string type_group
}
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- In
ContactForm, the inline normalization(contact.type === 'group' ? 'person' : contact.type) || 'person'is a bit dense; consider extracting this into a small helper (e.g.normalizeEditableContactType(contact.type)) to make the intent clearer and easier to extend if other non-editable types appear later. - The new
include_groups?: booleanflag inContactsListParams/ContactsSearchParamsoverlaps conceptually withtype?: 'person' | 'company' | 'group'; it may be worth clarifying or constraining how these interact (e.g. avoiding ambiguous combinations liketype: 'group', include_groups: false) by using a discriminated union or runtime validation.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In `ContactForm`, the inline normalization `(contact.type === 'group' ? 'person' : contact.type) || 'person'` is a bit dense; consider extracting this into a small helper (e.g. `normalizeEditableContactType(contact.type)`) to make the intent clearer and easier to extend if other non-editable types appear later.
- The new `include_groups?: boolean` flag in `ContactsListParams`/`ContactsSearchParams` overlaps conceptually with `type?: 'person' | 'company' | 'group'`; it may be worth clarifying or constraining how these interact (e.g. avoiding ambiguous combinations like `type: 'group', include_groups: false`) by using a discriminated union or runtime validation.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
… contacts (EVO-1018) - Add 'group' to Contact type union in TypeScript types - Add include_groups param to ContactsListParams and ContactsSearchParams - Update ContactTypeBadge to render 'Group' badge with Users icon for group type - Normalize group type to person in ContactForm (groups are not editable via form) - Add type.group translation key to all 6 locales (en, pt, pt-BR, es, fr, it) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…tering - Preserve original contact.type in form state so PATCH never resets a group contact's type to 'person' (H1) - Display group icon and label in edit-mode type display section (H1) - Add 'group' to ContactCreateData.type union; introduce taxIdType helper to keep tax ID utilities operating on person|company only - Refactor ContactTypeBadge to config-driven table, removing early returns and making future types trivial to add (L2) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
3be96ed to
136ac18
Compare
dpaes
approved these changes
May 13, 2026
dpaes
left a comment
There was a problem hiding this comment.
Round 2 aprovado. H1 (form group preservation) confirmado: type: contact.type || 'person' preserva grupos no edit. ContactTypeBadge config-driven, type.group traduzido nos 6 locales. Detalhes completos no card Linear EVO-1018. Mergeando.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
'group'toContacttype union in TypeScript typesinclude_groupsparam toContactsListParamsandContactsSearchParamsContactTypeBadgeto render 'Group' badge withUsersicon for group typepersoninContactForm(groups are not editable via form)type.grouptranslation key to all 6 locales (en, pt, pt-BR, es, fr, it)Validation
pnpm exec tsc -b --noEmit— ✅ no errorsRelated PRs
Linked Issue
Summary by Sourcery
Distinguish WhatsApp group contacts from regular person/company contacts in the contacts UI and type system.
New Features:
Enhancements: