[FIX] making the cleanRoomHistory method delete the files and attachments when deleting the messages#11046
[FIX] making the cleanRoomHistory method delete the files and attachments when deleting the messages#11046MarcosSpessatto wants to merge 6 commits intodevelopfrom
Conversation
making the cleanRoomHistory method delete the files and attachments when deleting the messages
| RocketChat.models.Uploads.remove({ | ||
| rid: roomId, | ||
| uploadedAt: { | ||
| $gte: oldest, |
There was a problem hiding this comment.
@MarcosSpessatto what do you think about use
const gt = inclusive ? '$gte' : 'gt'
uploadedAt: {
[gt] :.....
ggazzo
left a comment
There was a problem hiding this comment.
the PR is good to me, just tell me what do you think about the suggestion
Remove duplicated code in cleanRoomHistory method
|
@ggazzo I think it's a better approach, it reduces the amount of code. |
|
How will this impact the performance of this method? On a large team with many messages, clearing a lot of them takes very very long, so long it causes a gateway timeout... |
|
@MarcosSpessatto this does not remove the attachments, just the records that register the attachments location/url and metadata, wouldn't be better to delete the delete the files too? |
|
I've implemented further changes to this method in #11236. However, merging this may be useful for the time being until that PR is ready to merge. As for deleting the files fully, we can use |
Add delete file in clean history method
Closes #6749 Closes #8321 Closes #9374 Closes #2700 Closes #2639 Closes #2355 Closes #1861 Closes #8757 Closes #7228 Closes #10870 Closes #6193 Closes #11299 Closes #11468 Closes #9317 Closes #11300 (will incorporate a fix to this PR's issue) Closes #11046 (will incorporate a fix to this PR's issue) Contributes to #5944 Contributes to #11475 _...and possibly more!_ This PR makes deleting messages (automatically and manually) a lot easier on Rocket.Chat. - [X] Implement a bulk message deletion notification, to quickly push large message deletions to users without reload - [X] Use it in `rooms.cleanHistory` - [X] Use it in user deletions - [X] Completely remove cleanChannelHistory as required by v0.67 - [X] Remove server method `cleanChannelHistory` - [X] Remove REST API `channels.cleanHistory` - [x] Implement a sidebar option to clean history - [x] Basic implementation - [x] Allow excluding pinned messages - [x] Allow attachment-only mode - [x] Allow specifying user(s) to narrow down to - [x] Also update REST API - [x] Also update docs - [x] Break the deletion into multiple different requests, so the client can keep track of progress - [x] Clear animation / progress bar for deleting - [x] Retention policy - [X] Global, set by admin - [X] Global timer that runs every second and deletes messages over the set limit - [X] Can change its timer's resolution to prevent insane CPU overhead - [X] Admin can decide what room types to target (channels, groups and/or DMs) - [X] Allow excluding pinned messages - [X] Allow attachment-only mode - [x] Per-channel, set by those with a new permission - [x] Disabled when master switch off - [x] Set in channel info - [x] Can override global policy with a switch that requires `edit-privileged-setting` - [x] Allow excluding pinned messages - [x] Allow attachment-only mode - [x] Uses same global timer for cleanup - [X] Message at start of channel history / in channel info if there is a retention policy set - [x] Message in channel info if there is a retention policy set on that channel specifically - [X] Make cleaning history also delete files (completely!) - [X] Manual purging - [X] Automatic purging - [x] Make other deletions also delete files - [x] User deletion - [X] Own messages - [x] DMs with them's partner messages - [x] Room deletion - [x] Cleanup - [x] Finish related [docs](https://github.com/RocketChat/docs/pull/815) - [x] Link to the docs in the settings Please suggest any cool changes/additions! Any support is greatly appreciated. **Breaking change:** This PR removes REST API endpoint `channels.cleanHistory` and Meteor callable `cleanChannelHistory` as per the protocol specified for them. 
Closes #10870