mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-25 02:00:10 +02:00
Merge pull request #8802 from overleaf/bg-reset-last-updated-in-migration
[web] reset last updated date in history migration GitOrigin-RevId: 3d06eadf7d1dfb9b92a529d68de68f59370ab5de
This commit is contained in:
@@ -13,8 +13,9 @@
|
||||
*/
|
||||
const { Project } = require('../../models/Project')
|
||||
const logger = require('@overleaf/logger')
|
||||
const { promisifyAll } = require('../../util/promises')
|
||||
|
||||
module.exports = {
|
||||
const ProjectUpdateHandler = {
|
||||
markAsUpdated(projectId, lastUpdatedAt, lastUpdatedBy, callback) {
|
||||
if (callback == null) {
|
||||
callback = function () {}
|
||||
@@ -35,6 +36,26 @@ module.exports = {
|
||||
return Project.updateOne(conditions, update, {}, callback)
|
||||
},
|
||||
|
||||
// like markAsUpdated but allows lastUpdatedAt to be reset to earlier time
|
||||
resetUpdated(projectId, lastUpdatedAt, lastUpdatedBy, callback) {
|
||||
if (callback == null) {
|
||||
callback = function () {}
|
||||
}
|
||||
if (lastUpdatedAt == null) {
|
||||
lastUpdatedAt = new Date()
|
||||
}
|
||||
|
||||
const conditions = {
|
||||
_id: projectId,
|
||||
}
|
||||
|
||||
const update = {
|
||||
lastUpdated: lastUpdatedAt || new Date().getTime(),
|
||||
lastUpdatedBy,
|
||||
}
|
||||
return Project.updateOne(conditions, update, {}, callback)
|
||||
},
|
||||
|
||||
markAsOpened(project_id, callback) {
|
||||
const conditions = { _id: project_id }
|
||||
const update = { lastOpened: Date.now() }
|
||||
@@ -65,3 +86,6 @@ module.exports = {
|
||||
})
|
||||
},
|
||||
}
|
||||
|
||||
ProjectUpdateHandler.promises = promisifyAll(ProjectUpdateHandler)
|
||||
module.exports = ProjectUpdateHandler
|
||||
|
||||
Reference in New Issue
Block a user