Skip to content

web add contact to multiple groups - #405

Merged
Ronan-Fernandes merged 3 commits into
masterfrom
feature/BA-3331-fe-web-add-contact-to-multiple-groups
Aug 5, 2026
Merged

web add contact to multiple groups#405
Ronan-Fernandes merged 3 commits into
masterfrom
feature/BA-3331-fe-web-add-contact-to-multiple-groups

Conversation

@Ronan-Fernandes

@Ronan-Fernandes Ronan-Fernandes commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features
    • Added an “Add contact to group” flow from a profile, with group search, selection, and infinite scrolling.
    • Groups the contact already belongs to are disabled and labeled “Already added.”
    • Added confirmation handling with success and error feedback.
  • Bug Fixes
    • Prevented selection changes for groups where the contact is already a member.
  • Tests
    • Added coverage for toggling group selection without mutating the previous selection set.

@changeset-bot

changeset-bot Bot commented Jul 14, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: b0f6fec

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@Ronan-Fernandes Ronan-Fernandes self-assigned this Jul 14, 2026
@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 02857dda-746d-42a2-944f-fcd0a1ecdce5

📥 Commits

Reviewing files that changed from the base of the PR and between cc5f7d4 and b0f6fec.

📒 Files selected for processing (17)
  • packages/components/CHANGELOG.md
  • packages/components/modules/messages/common/__tests__/toggleGroupSelection.test.ts
  • packages/components/modules/messages/common/index.ts
  • packages/components/modules/messages/common/toggleGroupSelection.ts
  • packages/components/modules/messages/native/AddContactToGroupPage/index.tsx
  • packages/components/modules/messages/web/AddContactToGroupDialog/GroupsList/GroupItem/index.tsx
  • packages/components/modules/messages/web/AddContactToGroupDialog/GroupsList/GroupItem/styled.tsx
  • packages/components/modules/messages/web/AddContactToGroupDialog/GroupsList/GroupItem/types.ts
  • packages/components/modules/messages/web/AddContactToGroupDialog/GroupsList/index.tsx
  • packages/components/modules/messages/web/AddContactToGroupDialog/GroupsList/styled.tsx
  • packages/components/modules/messages/web/AddContactToGroupDialog/GroupsList/types.ts
  • packages/components/modules/messages/web/AddContactToGroupDialog/constants.ts
  • packages/components/modules/messages/web/AddContactToGroupDialog/index.tsx
  • packages/components/modules/messages/web/AddContactToGroupDialog/types.ts
  • packages/components/modules/messages/web/ProfileSummary/Body/index.tsx
  • packages/components/modules/messages/web/index.ts
  • packages/components/package.json
🚧 Files skipped from review as they are similar to previous changes (11)
  • packages/components/modules/messages/common/index.ts
  • packages/components/modules/messages/web/AddContactToGroupDialog/constants.ts
  • packages/components/modules/messages/web/index.ts
  • packages/components/modules/messages/web/AddContactToGroupDialog/GroupsList/types.ts
  • packages/components/modules/messages/common/toggleGroupSelection.ts
  • packages/components/modules/messages/web/AddContactToGroupDialog/types.ts
  • packages/components/modules/messages/web/AddContactToGroupDialog/GroupsList/GroupItem/types.ts
  • packages/components/modules/messages/web/ProfileSummary/Body/index.tsx
  • packages/components/modules/messages/web/AddContactToGroupDialog/GroupsList/styled.tsx
  • packages/components/modules/messages/web/AddContactToGroupDialog/GroupsList/GroupItem/index.tsx
  • packages/components/modules/messages/web/AddContactToGroupDialog/GroupsList/GroupItem/styled.tsx

📝 Walkthrough

Walkthrough

Adds shared group-selection toggling and implements a web flow for selecting groups and adding a contact to multiple chat rooms. The profile summary opens the new dialog from the existing add-contact action. Native imports use the shared helper.

Changes

Add contact to groups

Layer / File(s) Summary
Shared selection helper
packages/components/modules/messages/common/..., packages/components/modules/messages/native/AddContactToGroupPage/index.tsx
Adds and exports an immutable group-selection helper. The native flow imports the shared helper.
Web group list and dialog
packages/components/modules/messages/web/AddContactToGroupDialog/...
Adds searchable, paginated group rendering, membership-aware selection, mutation submission, loading states, and public exports.
Profile summary dialog wiring
packages/components/modules/messages/web/ProfileSummary/Body/index.tsx, packages/components/modules/messages/web/index.ts
Connects the add-contact action to the dialog and exports the dialog and its types.
Package release metadata
packages/components/CHANGELOG.md, packages/components/package.json
Documents the feature and updates the package version to 2.1.1.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant ProfileSummaryBody
  participant AddContactToGroupDialog
  participant GroupsList
  participant ChatRoomsMutation
  ProfileSummaryBody->>AddContactToGroupDialog: open with contactProfileId
  AddContactToGroupDialog->>GroupsList: render group selection
  GroupsList->>GroupsList: search and paginate groups
  AddContactToGroupDialog->>ChatRoomsMutation: submit selected roomIds
  ChatRoomsMutation-->>AddContactToGroupDialog: return mutation result
Loading

Possibly related PRs

Suggested reviewers: anicioalexandre

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The pull request has no description, so it does not document the feature, implementation, or testing details. Add a description that summarizes the feature, explains the main implementation changes, and lists relevant testing or validation performed.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the primary feature: adding a contact to multiple groups on the web.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/BA-3331-fe-web-add-contact-to-multiple-groups

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

packages/components/modules/messages/common/__tests__/toggleGroupSelection.test.ts

ESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox.

packages/components/modules/messages/common/index.ts

ESLint skipped: the ESLint configuration for this file references a package that is not available in the sandbox.

packages/components/modules/messages/common/toggleGroupSelection.ts

ESLint skipped: the ESLint configuration for this file references a package that is not available in the sandbox.

  • 13 others

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (2)
packages/components/modules/messages/web/AddContactToGroupDialog/GroupsList/GroupItem/index.tsx (1)

25-52: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Improve keyboard accessibility for the interactive row.

The MainContainer acts as a clickable row, but because it relies on a standard div (via MUI's Box), it lacks semantic interactions such as a role="button", an aria-disabled state, and onKeyDown handlers for full keyboard support. While the inner Checkbox component safely provides keyboard focus and interaction, users utilizing screen readers or keyboard navigation may have a degraded experience if they interact with the row container itself.

Consider using MUI's ListItemButton instead, which handles all of these accessibility features—including disabled behavior and full keyboard navigation—out of the box.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@packages/components/modules/messages/web/AddContactToGroupDialog/GroupsList/GroupItem/index.tsx`
around lines 25 - 52, Replace the clickable MainContainer in GroupItem with
MUI’s ListItemButton, preserving the existing disabled state, click handler,
layout styling, and checkbox interaction. Ensure the row retains accessible
button semantics and keyboard activation through ListItemButton while keeping
the inner Checkbox behavior unchanged.
packages/components/modules/messages/native/AddContactToGroupPage/index.tsx (1)

57-61: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Consider debouncing the search input.

Updating the search parameter on every keystroke triggers an immediate Relay refetch inside the GroupsList component via its useFocusEffect dependency. Consider debouncing this update to prevent dispatching excessive network requests while the user is rapidly typing.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/components/modules/messages/native/AddContactToGroupPage/index.tsx`
around lines 57 - 61, Debounce the search state update in handleSearchChange so
rapid typing does not trigger a Relay refetch through GroupsList on every
keystroke. Preserve the existing FORM_VALUES.search update and startTransition
behavior, applying the update only after the user pauses typing and cancelling
or replacing pending updates when new input arrives.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@packages/components/modules/messages/native/AddContactToGroupPage/GroupsList/GroupListItem/index.tsx`:
- Around line 36-49: Constrain the group item text layout: in GroupListItem,
apply styles.textContainer to the wrapper, limit the title Text to one line, and
remove the manual styles.spacer view. In
packages/components/modules/messages/native/AddContactToGroupPage/GroupsList/GroupListItem/styles.ts
lines 19-21, replace the spacer style with textContainer using flex: 1.

In
`@packages/components/modules/messages/native/AddContactToGroupPage/GroupsList/index.tsx`:
- Around line 35-44: Update handleEmptyState to safely evaluate the chat room
edge count when data.chatRooms.edges is nullish by optional-chaining edges or
applying a nullish fallback before checking for an empty state. Preserve the
existing SearchNotFoundState and EmptyGroupsState behavior.

---

Nitpick comments:
In `@packages/components/modules/messages/native/AddContactToGroupPage/index.tsx`:
- Around line 57-61: Debounce the search state update in handleSearchChange so
rapid typing does not trigger a Relay refetch through GroupsList on every
keystroke. Preserve the existing FORM_VALUES.search update and startTransition
behavior, applying the update only after the user pauses typing and cancelling
or replacing pending updates when new input arrives.

In
`@packages/components/modules/messages/web/AddContactToGroupDialog/GroupsList/GroupItem/index.tsx`:
- Around line 25-52: Replace the clickable MainContainer in GroupItem with MUI’s
ListItemButton, preserving the existing disabled state, click handler, layout
styling, and checkbox interaction. Ensure the row retains accessible button
semantics and keyboard activation through ListItemButton while keeping the inner
Checkbox behavior unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ea900683-86f0-4d34-8b52-2f2923172938

📥 Commits

Reviewing files that changed from the base of the PR and between 8d5e519 and ad83382.

📒 Files selected for processing (33)
  • packages/components/modules/messages/common/__tests__/toggleGroupSelection.test.ts
  • packages/components/modules/messages/common/graphql/fragments/AddContactToGroupItem.ts
  • packages/components/modules/messages/common/graphql/fragments/AddContactToGroupsList.ts
  • packages/components/modules/messages/common/graphql/mutations/AddParticipantToChatRooms.ts
  • packages/components/modules/messages/common/graphql/queries/AddContactToGroupsQuery.ts
  • packages/components/modules/messages/common/index.ts
  • packages/components/modules/messages/common/toggleGroupSelection.ts
  • packages/components/modules/messages/native/AddContactToGroupPage/EmptyGroupsState/index.tsx
  • packages/components/modules/messages/native/AddContactToGroupPage/GroupsList/GroupListItem/index.tsx
  • packages/components/modules/messages/native/AddContactToGroupPage/GroupsList/GroupListItem/styles.ts
  • packages/components/modules/messages/native/AddContactToGroupPage/GroupsList/GroupListItem/types.ts
  • packages/components/modules/messages/native/AddContactToGroupPage/GroupsList/index.tsx
  • packages/components/modules/messages/native/AddContactToGroupPage/GroupsList/types.ts
  • packages/components/modules/messages/native/AddContactToGroupPage/constants.ts
  • packages/components/modules/messages/native/AddContactToGroupPage/index.tsx
  • packages/components/modules/messages/native/AddContactToGroupPage/styles.ts
  • packages/components/modules/messages/native/AddContactToGroupPage/types.ts
  • packages/components/modules/messages/native/SingleChatDetailsPage/Options/index.tsx
  • packages/components/modules/messages/native/SingleChatDetailsPage/Options/type.ts
  • packages/components/modules/messages/native/SingleChatDetailsPage/index.tsx
  • packages/components/modules/messages/native/index.ts
  • packages/components/modules/messages/web/AddContactToGroupDialog/GroupsList/GroupItem/index.tsx
  • packages/components/modules/messages/web/AddContactToGroupDialog/GroupsList/GroupItem/styled.tsx
  • packages/components/modules/messages/web/AddContactToGroupDialog/GroupsList/GroupItem/types.ts
  • packages/components/modules/messages/web/AddContactToGroupDialog/GroupsList/index.tsx
  • packages/components/modules/messages/web/AddContactToGroupDialog/GroupsList/styled.tsx
  • packages/components/modules/messages/web/AddContactToGroupDialog/GroupsList/types.ts
  • packages/components/modules/messages/web/AddContactToGroupDialog/constants.ts
  • packages/components/modules/messages/web/AddContactToGroupDialog/index.tsx
  • packages/components/modules/messages/web/AddContactToGroupDialog/types.ts
  • packages/components/modules/messages/web/ProfileSummary/Body/index.tsx
  • packages/components/modules/messages/web/index.ts
  • packages/components/schema.graphql

@Ronan-Fernandes
Ronan-Fernandes changed the base branch from master to feature/BA-3074-fe-rn-add-contact-to-a-group July 16, 2026 19:37
@Ronan-Fernandes
Ronan-Fernandes force-pushed the feature/BA-3074-fe-rn-add-contact-to-a-group branch 3 times, most recently from a68703f to 6da1495 Compare July 16, 2026 20:20
@Ronan-Fernandes
Ronan-Fernandes force-pushed the feature/BA-3331-fe-web-add-contact-to-multiple-groups branch from ad83382 to f137c00 Compare July 16, 2026 20:51
Comment thread packages/components/modules/messages/web/AddContactToGroupDialog/index.tsx Outdated
Comment thread packages/components/modules/messages/web/AddContactToGroupDialog/index.tsx Outdated
Base automatically changed from feature/BA-3074-fe-rn-add-contact-to-a-group to master July 17, 2026 13:04
@Ronan-Fernandes
Ronan-Fernandes force-pushed the feature/BA-3331-fe-web-add-contact-to-multiple-groups branch from f137c00 to 59c9689 Compare July 17, 2026 15:50
@Ronan-Fernandes
Ronan-Fernandes force-pushed the feature/BA-3331-fe-web-add-contact-to-multiple-groups branch from cf8630a to b0f6fec Compare August 5, 2026 12:25
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@sonarqubecloud

sonarqubecloud Bot commented Aug 5, 2026

Copy link
Copy Markdown

@Ronan-Fernandes
Ronan-Fernandes merged commit 1e8ceee into master Aug 5, 2026
9 checks passed
@Ronan-Fernandes
Ronan-Fernandes deleted the feature/BA-3331-fe-web-add-contact-to-multiple-groups branch August 5, 2026 13:17
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.

3 participants