fix drops not showing until refresh

This commit is contained in:
Matteo Pagliazzi
2013-11-22 19:21:34 +01:00
parent 8955fb5a39
commit a8578602d7

View File

@@ -29,7 +29,12 @@ habitrpg.controller('NotificationCtrl',
});
$rootScope.$watch('user._tmp.drop', function(after, before){
if (after == before || !after) return;
if (!after) return;
var type = after.type === 'HatchingPotion' ? 'hatchingPotions' : (after.type.toLowerCase() + 's')
if(!User.user.items[type][after.name]){
User.user.items[type][after.name] = 0;
}
User.user.items[type][after.name]++;
$rootScope.modals.drop = true;
});