From aa0c69e082b199f2ad3a3650630b65e082af0793 Mon Sep 17 00:00:00 2001 From: base of tree Date: Sun, 23 Feb 2014 22:37:42 -0800 Subject: [PATCH] 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 --- script/userServices.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/script/userServices.js b/script/userServices.js index 8b2b3f7da3..d104ff9c0b 100644 --- a/script/userServices.js +++ b/script/userServices.js @@ -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,