Skip to content

Comments

feature/BA-2983-remove-member-from-group#344

Open
rf2tsl wants to merge 3 commits intomasterfrom
feature/BA-2983-remove-member-from-group
Open

feature/BA-2983-remove-member-from-group#344
rf2tsl wants to merge 3 commits intomasterfrom
feature/BA-2983-remove-member-from-group

Conversation

@rf2tsl
Copy link
Contributor

@rf2tsl rf2tsl commented Feb 14, 2026

Acceptance Criteria
Removing a Member

Given I am an admin of the group, when I select a member from the group details view, then I should have the option to remove that member from the group.

We should have already implemented the Remove Member option button in the Admin Permission story, but not the functionality.

Given I click on remove member, I should see a confirmation dialog, to make sure I want to do this action.

Given I confirm the removal of the member, then the removed member should no longer see the group in their chat list or have access to its messages.

We are doing a hard delete of the group chat for that user.

It should be implemented the same behavior as the web version.

Design Link: https://www.figma.com/design/z5ZdVlKEMmGIX4GVnjwfxA/BaseApp---NATIVE?node-id=3324-255017&t=TlbSP8vPOBBG6fwE-0

Approvd
https://app.approvd.io/silverlogic/BA/stories/41475

Summary by CodeRabbit

  • New Features

    • You can now initiate removing a member directly from the members list; the removal dialog opens automatically and targets the selected member.
    • Removal dialog button label now shows "Leave Group" for yourself and "Remove Member" for others.
  • Bug Fixes

    • Fixed removal flow and redirects so the correct participant is identified and handled during removal.
  • Other

    • Admin removal dialog title updated to "Remove group member?".

@changeset-bot
Copy link

changeset-bot bot commented Feb 14, 2026

⚠️ No Changeset found

Latest commit: 831db60

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

@coderabbitai
Copy link

coderabbitai bot commented Feb 14, 2026

No actionable comments were generated in the recent review. 🎉


📝 Walkthrough

Walkthrough

Threaded a new callback prop setMemberToRemoveId from GroupDetailsPageMembersMemberItem. When a member's Remove action is triggered the child calls the callback with that member's ID; GroupDetailsPage opens LeaveGroupDialog with that ID and clears it on close.

Changes

Cohort / File(s) Summary
Types
packages/components/modules/messages/native/GroupDetailsPage/Members/MemberItem/type.ts, packages/components/modules/messages/native/GroupDetailsPage/Members/type.ts
Added setMemberToRemoveId: (id: string | null) => void to MemberItemProps and MembersProps.
Member item & list
packages/components/modules/messages/native/GroupDetailsPage/Members/MemberItem/index.tsx, packages/components/modules/messages/native/GroupDetailsPage/Members/index.tsx
MemberItem remove handler now calls setMemberToRemoveId(profile.id) and closes the bottom drawer; Members accepts and forwards setMemberToRemoveId to each MemberItem.
Page state & dialog wiring
packages/components/modules/messages/native/GroupDetailsPage/index.tsx
Added memberToRemoveId state and handleSetMemberToRemove; opening LeaveGroupDialog when an ID is set, clearing it on close, and passing removingParticipantId = memberToRemoveId ?? currentProfile?.id.
Leave dialog UI/behavior
packages/components/modules/messages/native/__shared__/LeaveGroupDialog/index.tsx
Post-success navigation and button label now depend on whether the current profile equals removingParticipantId: label toggles between "Leave Group" and "Remove Member"; redirect to /messages only when the current profile was removed.
Constants
packages/components/modules/messages/common/useLeaveGroup/constants.ts
Changed dialog admin title from "Remove from chat?" to "Remove group member?" under IS_REMOVING.admin.

Sequence Diagram

sequenceDiagram
    participant User as User
    participant MI as MemberItem
    participant GP as GroupDetailsPage
    participant LGD as LeaveGroupDialog

    User->>MI: Click "Remove" on member
    MI->>GP: setMemberToRemoveId(memberId)
    GP->>GP: set memberToRemoveId state
    Note over GP,LGD: LeaveGroupDialog opens with removingParticipantId = memberToRemoveId ?? currentProfile.id
    User->>LGD: Confirm removal
    LGD->>GP: onClose()
    GP->>GP: clear memberToRemoveId
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • priscilladeroode
  • anicioalexandre

"🐰 I hop through props and open a gate,
A tiny ID tells which friend to state,
Dialog pops up with a gentle chime,
Remove or leave — all done in time,
Hooray for tidy prop-threading rhyme!"

🚥 Pre-merge checks | ✅ 3 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description provides acceptance criteria and context, but does not follow the required template structure with package name and version information. Update the description to follow the template format: list affected packages and their versions in the standardized changelog_info format.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the feature being implemented (removing a member from a group) and matches the main objective of the PR.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into master

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/BA-2983-remove-member-from-group

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 and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/components/modules/messages/native/__shared__/LeaveGroupDialog/index.tsx (1)

30-33: ⚠️ Potential issue | 🔴 Critical

Bug: Admin is redirected away after removing another member.

handleLeaveGroupSuccess always calls router.replace('/messages'), but when an admin removes someone else, they should stay on the group details page — only self-removal ("Leave Group") warrants navigating away.

Proposed fix
  const handleLeaveGroupSuccess = () => {
    onClose()
-   router.replace('/messages')
+   if (profileId === removingParticipantId) {
+     router.replace('/messages')
+   }
  }
🤖 Fix all issues with AI agents
In `@packages/components/modules/messages/native/GroupDetailsPage/index.tsx`:
- Line 48: The effect in GroupDetailsPage references openConfirmLeaveGroupDialog
but only lists memberToRemoveId in its dependency array, causing a hooks
dependency lint error; fix by including openConfirmLeaveGroupDialog in the
dependency array of the useEffect that closes over memberToRemoveId (or refactor
by memoizing openConfirmLeaveGroupDialog with useCallback and then add that
callback to the dependency array), so the effect's dependencies accurately
reflect the values it reads.
- Around line 44-48: Remove the useEffect that opens the confirm dialog and
replace it with an explicit handler (e.g., handleSetMemberToRemove) that calls
setMemberToRemoveId(id) and then setOpenConfirmLeaveGroupDialog(true); update
anywhere you pass setMemberToRemoveId (notably the Members component) to pass
handleSetMemberToRemove instead; keep onClose clearing memberToRemoveId and
closing the dialog as-is so retries of the same ID will reopen correctly and
avoid the stale-same-value edge case caused by effect-driven logic.

In
`@packages/components/modules/messages/native/GroupDetailsPage/Members/MemberItem/index.tsx`:
- Around line 135-137: The remove-member handler currently only calls
setMemberToRemoveId(profile.id) and does not close the bottom sheet, causing the
sheet to remain visible behind the confirmation dialog; update the handler used
in MemberItem (handleRemoveMember) to also call bottomDrawerRef.current?.close()
before setting the member ID (mirroring handleToggleAdminClicked behavior) so
the bottom drawer is dismissed prior to opening the LeaveGroupDialog/modal.

Copy link

@lokmanliton lokmanliton left a comment

Choose a reason for hiding this comment

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

Copy and modal title is not same as design,
Here in design it says - Remove group member? but in implementation, it is Remove from chat?

Image

@sonarqubecloud
Copy link

Copy link

@lokmanliton lokmanliton left a comment

Choose a reason for hiding this comment

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

Got a minor UX issue when I close remove group modal, It is not animated like other modals as per video.

https://www.loom.com/share/0cb2ef6603bb44079c9c1ea445b5d401

BTW, I am approving the pr.

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