cleanup on end tour

This commit is contained in:
Tyler Renelle
2013-09-12 16:45:13 -04:00
parent d3ddbae767
commit 0d8e1f2043
2 changed files with 16 additions and 18 deletions

View File

@@ -51,8 +51,7 @@ angular.module('guideServices', []).
$('.main-herobox').popover('destroy'); $('.main-herobox').popover('destroy');
var tour = new Tour({ var tour = new Tour({
onEnd: function(){ onEnd: function(){
User.user.flags.showTour = false; User.set('flags.showTour', false);
User.log({op:'set',data:{'flags.showTour':false}});
} }
}); });
tourSteps.forEach(function(step) { tourSteps.forEach(function(step) {

View File

@@ -135,38 +135,37 @@ angular.module('userServices', []).
}, },
log: function (action, cb) { log: function (action, cb) {
//push by one buy one if an array passed in. //push by one buy one if an array passed in.
if (_.isArray(action)) { if (_.isArray(action)) {
action.forEach(function (a) { action.forEach(function (a) {
settings.sync.queue.push(a); settings.sync.queue.push(a);
}); });
} else { } else {
settings.sync.queue.push(action); settings.sync.queue.push(action);
} }
save(); save();
syncQueue(cb); syncQueue(cb);
}, },
/* /*
Very simple path-set. `set('preferences.gender','m')` for example. We'll deprecate this once we have a complete API Very simple path-set. `set('preferences.gender','m')` for example. We'll deprecate this once we have a complete API
*/ */
set: function(k, v) { set: function(k, v) {
var self = userServices;
var log = { op: 'set', data: {} }; var log = { op: 'set', data: {} };
window.habitrpgShared.helpers.dotSet(k, v, userServices.user); window.habitrpgShared.helpers.dotSet(k, v, this.user);
log.data[k] = v; log.data[k] = v;
userServices.log(log); this.log(log);
}, },
setMultiple: function(obj){ setMultiple: function(obj){
var self = this; var self = this;
var log = { op: 'set', data: {} }; var log = { op: 'set', data: {} };
_.each(obj, function(v,k){ _.each(obj, function(v,k){
window.habitrpgShared.helpers.dotSet(k, v, userServices.user); window.habitrpgShared.helpers.dotSet(k, v, self.user);
log.data[k] = v; log.data[k] = v;
}) });
userServices.log(log); self.log(log);
}, },
save: save, save: save,