Fixes #1528. Stores the currently selected tags locally before synchronizing with the server and restores them after the new user object comes back down the pipe. One potential issue that should probably be fixed is if a tag is deleted on another client that has it selected, there is no visual feedback showing that a tag is still selected, but there are no tasks shown because a null tag is selected. This is fixed by pressing "clear filters", but null filters should probably be checked eventually

This commit is contained in:
base of tree 2014-02-23 22:37:42 -08:00
parent e0c2243185
commit aa0c69e082

View file

@ -56,6 +56,9 @@ angular.module('userServices', []).
sent.push(queue.shift());
});
// Save the current filters
var current_filters = user.filters;
$http.post(API_URL + '/api/v2/user/batch-update', sent, {params: {data:+new Date, _v:user._v, siteVersion: $window.env && $window.env.siteVersion}})
.success(function (data, status, heacreatingders, config) {
//make sure there are no pending actions to sync. If there are any it is not safe to apply model from server as we may overwrite user data.
@ -70,6 +73,8 @@ angular.module('userServices', []).
// Update user
_.extend(user, data);
// Preserve filter selections between syncs
_.extend(user.filters,current_filters);
if (!user._wrapped){
// This wraps user with `ops`, which are functions shared both on client and mobile. When performed on client,