Merge pull request #17553 from overleaf/mj-admin-history-ranges-enable

[web] Add button for adding history ranges support in admin panel

GitOrigin-RevId: fa85b25719fff753f0d0806ccb02ad2f9db2ee82
This commit is contained in:
Mathias Jakobsen
2024-03-28 09:03:51 +00:00
committed by Copybot
parent 919a83c193
commit 44d0b947ce
2 changed files with 42 additions and 0 deletions
@@ -1,6 +1,7 @@
const { Project } = require('../../models/Project')
const settings = require('@overleaf/settings')
const { callbackify } = require('util')
const { db, ObjectId } = require('../../infrastructure/mongodb')
const safeCompilers = ['xelatex', 'pdflatex', 'latex', 'lualatex']
const ProjectOptionsHandler = {
@@ -62,6 +63,14 @@ const ProjectOptionsHandler = {
const update = { $unset: { brandVariationId: 1 } }
return Project.updateOne(conditions, update, {})
},
async enableHistoryRangesSupport(projectId) {
const conditions = { _id: new ObjectId(projectId) }
const update = { $set: { 'overleaf.history.rangesSupportEnabled': true } }
// NOTE: Updating the Mongoose model with the same query doesn't work. Maybe
// because rangesSupportEnabled is not part of the schema?
return db.projects.updateOne(conditions, update)
},
}
module.exports = {
@@ -74,5 +83,8 @@ module.exports = {
unsetBrandVariationId: callbackify(
ProjectOptionsHandler.unsetBrandVariationId
),
enableHistoryRangesSupport: callbackify(
ProjectOptionsHandler.enableHistoryRangesSupport
),
promises: ProjectOptionsHandler,
}