More Client Fixes (#9036)

* add automatic user syncing when user._v does not match with server

* fix google signup

* fixes to user sync

* check for next cron on activity

* add comment
This commit is contained in:
Matteo Pagliazzi
2017-09-14 18:55:17 +02:00
committed by GitHub
parent 2f913666cd
commit c6881c5e30
4 changed files with 59 additions and 26 deletions

View File

@@ -10,15 +10,9 @@ module.exports = function responseHandler (req, res, next) {
if (message) response.message = message;
// When userV=Number (user version) query parameter is passed and a user is logged in,
// sends back the current user._v in the response so that the client
// can verify if it's the most up to date data.
// Considered part of the private API for now and not officially supported
if (user) {
response.notifications = user.notifications.map(notification => notification.toJSON());
if (req.query.userV) {
response.userV = user._v;
}
response.userV = user._v;
}
res.status(status).json(response);