Skip to content

Commit ecda739

Browse files
committed
set history.maxReviews setting limit to 15, migration changes all Collection Settings that specify a history.maxReviews >15 or = -1 to 15. Does not delete history as part of operation. History records will be pruned to new limit on subsequent review updates.
1 parent 35d801d commit ecda739

File tree

4 files changed

+25
-7
lines changed

4 files changed

+25
-7
lines changed

api/source/service/ReviewService.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -506,9 +506,7 @@ from
506506
await connection.query('START TRANSACTION')
507507

508508
if (counts[0].updates) {
509-
if (historyMaxReviews !== -1) {
510509
await connection.query(sqlHistoryPrune, [ historyMaxReviews ])
511-
}
512510
if (historyMaxReviews !== 0) {
513511
await connection.query(sqlHistory)
514512
}
@@ -1289,9 +1287,7 @@ where
12891287
async function transaction () {
12901288
await connection.query('START TRANSACTION')
12911289
if (counts[0].updates) {
1292-
if (historyMaxReviews !== -1) {
12931290
await connection.query(sqlHistoryPrune, [ historyMaxReviews ])
1294-
}
12951291
if (historyMaxReviews !== 0) {
12961292
await connection.query(sqlHistory)
12971293
}

api/source/service/migrations/0033.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
const MigrationHandler = require('./lib/MigrationHandler')
2+
3+
const upMigration = [
4+
`UPDATE collection
5+
SET settings = JSON_SET(settings, '$.history.maxReviews', 15)
6+
WHERE JSON_EXTRACT(settings, '$.history.maxReviews') = -1
7+
OR JSON_EXTRACT(settings, '$.history.maxReviews') > 15
8+
`
9+
]
10+
11+
const downMigration = [
12+
]
13+
14+
const migrationHandler = new MigrationHandler(upMigration, downMigration)
15+
module.exports = {
16+
up: async (pool) => {
17+
await migrationHandler.up(pool, __filename)
18+
},
19+
down: async (pool) => {
20+
await migrationHandler.down(pool, __filename)
21+
}
22+
}
23+

api/source/specification/stig-manager.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4960,7 +4960,7 @@ components:
49604960
properties:
49614961
maxReviews:
49624962
example: 5
4963-
maximum: 50
4963+
maximum: 15
49644964
minimum: -1
49654965
type: integer
49664966
required:

client/src/js/SM/CollectionForm.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1675,10 +1675,9 @@ SM.Collection.HistorySettings.MaxReviewsComboBox = Ext.extend(Ext.form.ComboBox,
16751675
let data = [
16761676
[0, 'disabled']
16771677
]
1678-
for (let limit = 1; limit < 51; limit++) {
1678+
for (let limit = 1; limit < 16; limit++) {
16791679
data.push([limit, `capped at ${limit}`])
16801680
}
1681-
data.push([-1, 'unlimited'])
16821681
this.store = new Ext.data.SimpleStore({
16831682
fields: ['value', 'display']
16841683
})

0 commit comments

Comments
 (0)