Fixed FIFO for post revisions (#16696)

no issue

- with this change, the oldest revision will be deleted and the new
revision will be added if the limit is reached
This commit is contained in:
Chris Raible 2023-04-21 13:34:12 +01:00 committed by GitHub
parent 9ab4579084
commit 857a5ad004
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -80,7 +80,9 @@ class PostRevisions {
];
}
return [currentRevision, ...revisions].slice(0, this.config.max_revisions);
// Grab the most recent revisions, limited by max_revisions
const updatedRevisions = [...revisions, currentRevision];
return updatedRevisions.slice(updatedRevisions.length - this.config.max_revisions, updatedRevisions.length);
}
/**