You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a channel is configured to override the global retention policy, there is no option to set the "Do not prune Threads" option within the channel's own retention policy, and no default value is set for the Room.retention.ignoreThreads setting, therefore threads are always ignored during message pruning on a channel that overrides the global retention policy.
Steps to reproduce:
Enable the retention policy at /admin/RetentionPolicy and ensure that the global policy does not apply to channels
Open the Room information panel within a channel (e.g. /channel/general/channel-settings)
Click Edit and enable Automatically prune old messages and Override global retention policy
Observe that there is no Do not prune Threads option
Post a message to the channel, then reply to the message in order to create a thread
Update the message timestamps (ts field in the MongoDB documents), so that they are older than the configured maximum age
Trigger message pruning
Observe that the thread is not deleted, despite being older than the configured maximum age
Expected behavior:
There should be an option to configure the Do not prune threads retention policy setting on a per-channel basis
When the Do not prune Threads setting is disabled, threaded messages that are older than the maximum age should be deleted when the message pruning task runs
Actual behavior:
There is no option to configure the Do not prune threads retention policy setting on a per-channel basis
Threaded messages are never deleted if a channel overrides the global policy
Server Setup Information:
Version of Rocket.Chat Server: 3.14.4
Deployment Method: snap
Additional context
I created a debug build to investigate this issue. I logged room.retention at the following location and found that ignoreThreads was undefined in all cases where a channel had a retention policy enabled:
The above then calls cleanRoomHistory() and passes the ignoreThreads variable to it. The body of the following if statement is never executed for rooms that override the global policy, due to ignoreThreads always being undefined:
This bug can be resolved by logging on to the server, connecting to the MongoDB instance, and running the following commands:
use parties
db.rocketchat_room.update({"retention.enabled": true}, {"$set": {"retention.ignoreThreads":false}}, {"multi":true})
This sets the retention.ignoreThreads setting to false on all rooms/channels that have a retention policy enabled, which will result in threaded messages being deleted by the message pruning task (provided they are older than the maximum age).
The text was updated successfully, but these errors were encountered:
As per the guide in the bug reporting template please try and test this on the lastest code if at all possible just to make sure it hasn't been fixed already.
Description:
When a channel is configured to override the global retention policy, there is no option to set the "Do not prune Threads" option within the channel's own retention policy, and no default value is set for the
Room.retention.ignoreThreads
setting, therefore threads are always ignored during message pruning on a channel that overrides the global retention policy.Steps to reproduce:
/admin/RetentionPolicy
and ensure that the global policy does not apply to channelsRoom information
panel within a channel (e.g./channel/general/channel-settings
)Edit
and enableAutomatically prune old messages
andOverride global retention policy
Do not prune Threads
optionts
field in the MongoDB documents), so that they are older than the configured maximum ageExpected behavior:
Do not prune threads
retention policy setting on a per-channel basisDo not prune Threads
setting is disabled, threaded messages that are older than the maximum age should be deleted when the message pruning task runsActual behavior:
Do not prune threads
retention policy setting on a per-channel basisServer Setup Information:
Additional context
I created a debug build to investigate this issue. I logged
room.retention
at the following location and found thatignoreThreads
wasundefined
in all cases where a channel had a retention policy enabled:Rocket.Chat/app/retention-policy/server/cronPruneMessages.js
Line 50 in 119028b
The above then calls
cleanRoomHistory()
and passes theignoreThreads
variable to it. The body of the followingif
statement is never executed for rooms that override the global policy, due toignoreThreads
always beingundefined
:Rocket.Chat/app/lib/server/functions/cleanRoomHistory.js
Lines 42 to 50 in 157b882
The
ignoreThreads
variable also gets passed toMessages.removeByIdPinnedTimestampLimitAndUsers()
here:Rocket.Chat/app/lib/server/functions/cleanRoomHistory.js
Line 52 in 157b882
Again, the body of the following
if
statement is never executed becauseignoreThreads
is alwaysundefined
:Rocket.Chat/app/models/server/models/Messages.js
Lines 970 to 973 in 157b882
Temporary Workaround
This bug can be resolved by logging on to the server, connecting to the MongoDB instance, and running the following commands:
This sets the
retention.ignoreThreads
setting to false on all rooms/channels that have a retention policy enabled, which will result in threaded messages being deleted by the message pruning task (provided they are older than the maximum age).The text was updated successfully, but these errors were encountered: