-
Notifications
You must be signed in to change notification settings - Fork 13k
fix: cleanRoomHistory with filesOnly=true removes all attachments including quotes #35797
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
fix: cleanRoomHistory with filesOnly=true removes all attachments including quotes #35797
Conversation
|
Looks like this PR is not ready to merge, because of the following issues:
Please fix the issues and try again If you have any trouble, please check the PR guidelines |
🦋 Changeset detectedLatest commit: e0f5256 The changes in this PR will be included in the next version bump. This PR includes changesets to release 36 packages
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 |
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #35797 +/- ##
===========================================
- Coverage 64.70% 64.68% -0.02%
===========================================
Files 3248 3248
Lines 95318 95318
Branches 17898 17858 -40
===========================================
- Hits 61674 61661 -13
- Misses 30740 30751 +11
- Partials 2904 2906 +2
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
…otes Signed-off-by: Abhinav Kumar <[email protected]>
Signed-off-by: Abhinav Kumar <[email protected]>
Signed-off-by: Abhinav Kumar <[email protected]>
690eb31 to
0d9f23d
Compare
Code Review Completed! 🔥The code review was successfully completed based on your current configurations. Kody Guide: Usage and ConfigurationInteracting with Kody
Current Kody ConfigurationReview OptionsThe following review options are enabled or disabled:
|
Signed-off-by: Abhinav Kumar <[email protected]>
Kody Review CompleteGreat news! 🎉 Keep up the excellent work! 🚀 Kody Guide: Usage and ConfigurationInteracting with Kody
Current Kody ConfigurationReview OptionsThe following review options are enabled or disabled:
|
Signed-off-by: Abhinav Kumar <[email protected]>
Kody Review CompleteGreat news! 🎉 Keep up the excellent work! 🚀 Kody Guide: Usage and ConfigurationInteracting with Kody
Current Kody ConfigurationReview OptionsThe following review options are enabled or disabled:
|
Kody Review CompleteGreat news! 🎉 Keep up the excellent work! 🚀 Kody Guide: Usage and ConfigurationInteracting with Kody
Current Kody ConfigurationReview OptionsThe following review options are enabled or disabled:
|
1 similar comment
Kody Review CompleteGreat news! 🎉 Keep up the excellent work! 🚀 Kody Guide: Usage and ConfigurationInteracting with Kody
Current Kody ConfigurationReview OptionsThe following review options are enabled or disabled:
|
Signed-off-by: Abhinav Kumar <[email protected]>
862f414 to
50a1714
Compare
Kody Review CompleteGreat news! 🎉 Keep up the excellent work! 🚀 Kody Guide: Usage and ConfigurationInteracting with Kody
Current Kody ConfigurationReview OptionsThe following review options are enabled or disabled:
|
Code Review Completed! 🔥The code review was successfully completed based on your current configurations. Kody Guide: Usage and ConfigurationInteracting with Kody
Current Kody ConfigurationReview OptionsThe following review options are enabled or disabled:
|
Proposed changes (including videos or screenshots)
When
filesOnlyis set totrue, the current pruning logic removes all attachments—including quotes and other non file attachments This fix ensures only attachments of typefile(e.g., images, documents, videos) are pruned while keeping non-file attachments intact.This impacts:
/admin/settings/RetentionPolicyrooms.cleanHistoryendpointIssue(s)
Steps to test or reproduce
rooms.cleanHistoryAPI withfilesOnly: true.Further comments
CORE-1051
This pull request addresses an issue in the Rocket.Chat repository where the
cleanRoomHistoryfunction, when invoked withfilesOnly=true, was incorrectly removing all attachments, including quotes. The changes ensure that only file-type attachments are removed, preserving quotes and other non-file attachments.Key changes include:
Refactoring in
cleanRoomHistory.ts: The method for handling file attachment removal has been optimized. Instead of updating each message individually, the process now collects all relevant message IDs and performs bulk database operations to remove attachments and clear file-related fields, improving performance.New Method in
IMessagesModel.ts: A method has been added to remove file attachments by message IDs, with an optional replacement feature.Enhancements in
Messages.ts: A new method is introduced to efficiently remove file attachments from messages using MongoDB aggregation operators, with an option to replace the attachments.Changeset Entries: Two changeset files have been added to document the patch affecting
@rocket.chat/model-typings,@rocket.chat/models, and@rocket.chat/meteor.These updates ensure that the room history pruning functionality works as intended, maintaining non-file attachments while removing only the specified file-type attachments.