mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-03 14:19:01 +02:00
Merge pull request #9647 from overleaf/bg-dropbox-to-overleaf-existing-doc
handle updates to existing doc in dropbox to overleaf metadata GitOrigin-RevId: e82955a4a76e62fb649263a94103fdb7f322de85
This commit is contained in:
@@ -94,7 +94,7 @@ function setDocument(req, res, next) {
|
||||
ranges,
|
||||
lastUpdatedAt,
|
||||
lastUpdatedBy,
|
||||
error => {
|
||||
(error, result) => {
|
||||
if (error) {
|
||||
OError.tag(error, 'error finding element for getDocument', {
|
||||
docId,
|
||||
@@ -106,7 +106,7 @@ function setDocument(req, res, next) {
|
||||
{ docId, projectId },
|
||||
'finished receiving set document request from api (docupdater)'
|
||||
)
|
||||
res.sendStatus(200)
|
||||
res.json(result)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
@@ -201,7 +201,7 @@ const ProjectEntityUpdateHandler = {
|
||||
)
|
||||
// path will only be present if the doc is not deleted
|
||||
if (!modified || isDeletedDoc) {
|
||||
return callback()
|
||||
return callback(null, { rev })
|
||||
}
|
||||
// Don't need to block for marking as updated
|
||||
ProjectUpdateHandler.markAsUpdated(
|
||||
@@ -218,7 +218,12 @@ const ProjectEntityUpdateHandler = {
|
||||
rev,
|
||||
folderId: folder?._id,
|
||||
},
|
||||
callback
|
||||
err => {
|
||||
if (err) {
|
||||
return callback(err)
|
||||
}
|
||||
callback(null, { rev, modified })
|
||||
}
|
||||
)
|
||||
}
|
||||
)
|
||||
@@ -741,7 +746,7 @@ const ProjectEntityUpdateHandler = {
|
||||
userId,
|
||||
docLines,
|
||||
source,
|
||||
err => {
|
||||
(err, result) => {
|
||||
if (err != null) {
|
||||
return callback(err)
|
||||
}
|
||||
@@ -749,16 +754,11 @@ const ProjectEntityUpdateHandler = {
|
||||
{ projectId, docId: existingDoc._id },
|
||||
'notifying users that the document has been updated'
|
||||
)
|
||||
DocumentUpdaterHandler.flushDocToMongo(
|
||||
projectId,
|
||||
existingDoc._id,
|
||||
err => {
|
||||
if (err != null) {
|
||||
return callback(err)
|
||||
}
|
||||
callback(null, existingDoc, existingDoc == null)
|
||||
}
|
||||
)
|
||||
// there is no need to flush the doc to mongo at this point as docupdater
|
||||
// flushes it as part of setDoc.
|
||||
//
|
||||
// combine rev from response with existing doc metadata
|
||||
callback(null, { ...existingDoc, ...result }, existingDoc == null)
|
||||
}
|
||||
)
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user