show dropbox sync status on settings page

GitOrigin-RevId: 843950ea236bd80c605cf184959a7ce2d7895693
This commit is contained in:
Ersun Warncke 2020-04-15 07:37:05 -04:00 committed by Copybot
parent 7c00b2d838
commit 09667a3f6a
3 changed files with 34 additions and 0 deletions

View file

@ -12,12 +12,15 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
let parseParams
const tpdsUpdateHandler = require('./TpdsUpdateHandler')
const UpdateMerger = require('./UpdateMerger')
const logger = require('logger-sharelatex')
const Path = require('path')
const metrics = require('metrics-sharelatex')
const NotificationsBuilder = require('../Notifications/NotificationsBuilder')
const AuthenticationController = require('../Authentication/AuthenticationController')
const TdpsQueueManager = require('./TpdsQueueManager').promises
module.exports = {
// mergeUpdate and deleteUpdate are used by Dropbox, where the project is only passed as the name, as the
@ -130,6 +133,16 @@ module.exports = {
})
},
async getQueues(req, res) {
const userId = AuthenticationController.getLoggedInUserId(req)
try {
res.json(await TdpsQueueManager.getQueues(userId))
} catch (err) {
logger.error({ err, userId }, 'error getting queues')
res.json({ error: 'error getting queues' })
}
},
parseParams: (parseParams = function(req) {
let filePath, projectName
let path = req.params[0]

View file

@ -0,0 +1,15 @@
const Settings = require('settings-sharelatex')
const request = require('request-promise-native')
async function getQueues(userId) {
return request({
uri: `${Settings.apis.tpdsworker.url}/queues/${userId}`,
json: true
})
}
module.exports = {
promises: {
getQueues
}
}

View file

@ -246,6 +246,12 @@ function initialize(webRouter, privateApiRouter, publicApiRouter) {
)
// for /user/reconfirm POST, see password router
webRouter.get(
'/user/tpds/queues',
AuthenticationController.requireLogin(),
TpdsController.getQueues
)
webRouter.get(
'/user/projects',
AuthenticationController.requireLogin(),