Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add multi-delete functionality for messages. #34952

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

AyushKumar123456789
Copy link

Proposed changes (including videos or screenshots)

This PR implements a new multi-delete functionality . The changes include:

  • Added Checkbox in Default Message Items:
    A checkbox now appears with each message; however, it is rendered only if the current user has permission to delete that message.

  • Implemented MultiDeleteButton Component:
    A new component, MultiDeleteButton, has been added. When multiple messages are selected, this button appears (via the Room header toolbox). Upon clicking, a confirmation modal is shown, and on confirmation, the component uses hook to call the existing chat.delete endpoint for each selected message.

  • Integration into RoomHeader:
    The MultiDeleteButton is injected into the RoomHeader ,So that the multi-delete option is easily accessible in the header's toolbox area.

Issue(s)

Closes #917

Steps to test or reproduce

  1. Navigate to any chat room where you have permission to delete messages.
  2. Verify that each message shows a delete checkbox only if you have permission to delete that message.
  3. Select multiple messages by clicking their checkboxes.
  4. Ensure that when more than one message is selected, a trash icon appears in the room header’s toolbox.
  5. Click the trash icon to open the confirmation modal.
  6. Confirm deletion, and verify that:
    • A success toast is displayed upon successful deletion,
    • The selected messages are removed,
    • The checkbox state is cleared.

Further comments

This change improves message management efficiency by enabling bulk deletion of messages. The implementation builds upon our existing deletion endpoint for individual messages. I have taken great care to preserve the existing code structure wherever possible. In areas such as the header title and the generic modal, I used raw message strings (with underscores) in cases where a proper translation did not yet exist, to ensure accurate rendering in the meantime. It is recommended that new translation keys be added to our i18n files for complete localization. I appreciate any feedback on further refinements or additional requirements.

multidelete.mp4

@AyushKumar123456789 AyushKumar123456789 requested a review from a team as a code owner January 16, 2025 11:49
Copy link

changeset-bot bot commented Jan 16, 2025

🦋 Changeset detected

Latest commit: fb32d6d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 35 packages
Name Type
@rocket.chat/meteor Patch
@rocket.chat/core-typings Patch
@rocket.chat/rest-typings Patch
@rocket.chat/uikit-playground Patch
@rocket.chat/api-client Patch
@rocket.chat/apps Patch
@rocket.chat/core-services Patch
@rocket.chat/cron Patch
@rocket.chat/ddp-client Patch
@rocket.chat/freeswitch Patch
@rocket.chat/fuselage-ui-kit Patch
@rocket.chat/gazzodown Patch
@rocket.chat/livechat Patch
@rocket.chat/model-typings Patch
@rocket.chat/ui-contexts Patch
@rocket.chat/account-service Patch
@rocket.chat/authorization-service Patch
@rocket.chat/ddp-streamer Patch
@rocket.chat/omnichannel-transcript Patch
@rocket.chat/presence-service Patch
@rocket.chat/queue-worker Patch
@rocket.chat/stream-hub-service Patch
@rocket.chat/license Patch
@rocket.chat/omnichannel-services Patch
@rocket.chat/pdf-worker Patch
@rocket.chat/presence Patch
rocketchat-services Patch
@rocket.chat/models Patch
@rocket.chat/network-broker Patch
@rocket.chat/ui-avatar Patch
@rocket.chat/ui-client Patch
@rocket.chat/ui-video-conf Patch
@rocket.chat/ui-voip Patch
@rocket.chat/web-ui-registration Patch
@rocket.chat/instance-status Patch

Not sure what this means? Click here to learn what changesets are.

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

Copy link
Contributor

dionisio-bot bot commented Jan 16, 2025

Looks like this PR is not ready to merge, because of the following issues:

  • This PR is missing the 'stat: QA assured' label
  • This PR is missing the required milestone or project

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

@AyushKumar123456789 AyushKumar123456789 changed the title [NEW] Multi-delete functionality for messages (#917) feat: add multi-delete functionality for messages. Jan 16, 2025
@AyushKumar123456789
Copy link
Author

I’ve updated the PR title, trying to ensure it might align with the required format. Please let me know if there’s anything else I need to address or improve. I’m happy to make further changes if required.

Copy link
Member

@dougfabris dougfabris left a comment

Choose a reason for hiding this comment

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

The addition is really great but the way you implemented its not really friendly.
I would like to suggest some changes so we could merge the feature:

  1. We already have a pattern to select multiple messages, you can check it trying to use the export message feature.
  2. Instead of opening the confirmation modal when clicking in Delete message, you could open turn on the selection mode, selecting the initial message and allowing the user to select more and we can render a similar composer we have for export messages but now with the action to delete
  3. Now clicking on delete the confirmation modal is displayed

@AyushKumar123456789
Copy link
Author

Thank you for the feedback. I appreciate the suggestions and will update the PR to use the selection mode approach as suggested. I'll work on the changes soon. Thanks for helping improve this feature!

@AyushKumar123456789
Copy link
Author

This implementation follows the existing pattern for selecting multiple messages, similar to the export message feature. When the delete button is clicked, the UI enters selection mode, allowing users to select the initial message and additional messages. A composer has been added to facilitate the deletion of selected messages .

multi.message.delete.mp4
thread.message.delete.mp4

I have also added a Doc , For detailed information on the implementation : Doc Link

Thank you for your time and consideration. I appreciate any further feedback to improve this feature.

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.

Feature request : Multiple Messages Select and Delete Functionality.
3 participants