Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
Rocket.Chat
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
RocketChat
Rocket.Chat
Commits
41a1816e
Unverified
Commit
41a1816e
authored
7 months ago
by
gabriellsh
Committed by
GitHub
7 months ago
Browse files
Options
Downloads
Patches
Plain Diff
fix: Retention Policy cached settings not updated during upgrade procedure (#33237)
parent
18b1b992
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.changeset/pink-swans-teach.md
+5
-0
5 additions, 0 deletions
.changeset/pink-swans-teach.md
apps/meteor/server/startup/migrations/xrun.ts
+12
-2
12 additions, 2 deletions
apps/meteor/server/startup/migrations/xrun.ts
with
17 additions
and
2 deletions
.changeset/pink-swans-teach.md
0 → 100644
+
5
−
0
View file @
41a1816e
---
"
@rocket.chat/meteor"
:
patch
---
fixed retention policy max age settings not being respected after upgrade
This diff is collapsed.
Click to expand it.
apps/meteor/server/startup/migrations/xrun.ts
+
12
−
2
View file @
41a1816e
...
...
@@ -2,6 +2,7 @@ import { Settings } from '@rocket.chat/models';
import
type
{
UpdateResult
}
from
'
mongodb
'
;
import
{
upsertPermissions
}
from
'
../../../app/authorization/server/functions/upsertPermissions
'
;
import
{
settings
}
from
'
../../../app/settings/server
'
;
import
{
migrateDatabase
,
onServerVersionChange
}
from
'
../../lib/migrations
'
;
import
{
ensureCloudWorkspaceRegistered
}
from
'
../cloudRegistration
'
;
...
...
@@ -23,10 +24,13 @@ const moveRetentionSetting = async () => {
{
_id
:
{
$in
:
Array
.
from
(
maxAgeSettingMap
.
keys
())
},
value
:
{
$ne
:
-
1
}
},
{
projection
:
{
_id
:
1
,
value
:
1
}
},
).
forEach
(({
_id
,
value
})
=>
{
if
(
!
maxAgeSettingMap
.
has
(
_id
))
{
const
newSettingId
=
maxAgeSettingMap
.
get
(
_id
);
if
(
!
newSettingId
)
{
throw
new
Error
(
`moveRetentionSetting - Setting
${
_id
}
equivalent does not exist`
);
}
const
newValue
=
convertDaysToMs
(
Number
(
value
));
promises
.
push
(
Settings
.
updateOne
(
{
...
...
@@ -34,11 +38,17 @@ const moveRetentionSetting = async () => {
},
{
$set
:
{
value
:
convertDaysToMs
(
Number
(
v
alue
))
,
value
:
newV
alue
,
},
},
),
);
const
currentCache
=
settings
.
getSetting
(
newSettingId
);
if
(
!
currentCache
)
{
return
;
}
settings
.
set
({
...
currentCache
,
value
:
newValue
});
});
await
Promise
.
all
(
promises
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment