mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 15:48:04 +01:00
fix #1803, when getting a drop do not return whole user, @lefnire it is ok to change api return data or we need to annouce it before so that third parties can update their code?
This commit is contained in:
@@ -39,6 +39,7 @@ habitrpg.controller('NotificationCtrl',
|
||||
});
|
||||
|
||||
$rootScope.$watch('user.achievements.ultimateGear', function(after, before){
|
||||
console.log(after, before)
|
||||
if (after === before || after !== true) return;
|
||||
$rootScope.modals.achievements.ultimateGear = true;
|
||||
});
|
||||
|
||||
@@ -65,13 +65,14 @@ angular.module('userServices', []).
|
||||
// the user has been modified from another application, sync up
|
||||
if(data.wasModified) {
|
||||
delete data.wasModified;
|
||||
_.extend(user, data);
|
||||
$rootScope.$emit('userUpdated', user);
|
||||
}
|
||||
|
||||
// Update user
|
||||
_.extend(user, data);
|
||||
|
||||
// Emit event when user is synced
|
||||
$rootScope.$emit('userSynced');
|
||||
user._v = data._v;
|
||||
}
|
||||
sent.length = 0;
|
||||
settings.fetching = false;
|
||||
|
||||
@@ -566,10 +566,9 @@ api.batchUpdate = function(req, res, next) {
|
||||
if (err) return res.json(500, {err: err});
|
||||
var response = user.toJSON();
|
||||
response.wasModified = res.locals.wasModified;
|
||||
if (response._tmp && response._tmp.drop) response.wasModified = true;
|
||||
|
||||
// Send the response to the server
|
||||
if(response.wasModified){
|
||||
if (response._tmp && response._tmp.drop){
|
||||
res.json(200, {_tmp: {drop: response._tmp.drop}, _v: response._v});
|
||||
}else if(response.wasModified){
|
||||
res.json(200, response);
|
||||
}else{
|
||||
res.json(200, {_v: response._v});
|
||||
|
||||
Reference in New Issue
Block a user