From 7e69ebbc460ec2e70b1b7c6e537d50306049ad4e Mon Sep 17 00:00:00 2001 From: Oleg Slepov Date: Thu, 3 Dec 2015 14:14:57 +0300 Subject: [PATCH] Bug 1197072 - Fix changing sort by last name when the user kills app --- .../contacts/js/views/settings.js | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/apps/communications/contacts/js/views/settings.js b/apps/communications/contacts/js/views/settings.js index d2e63d643bad..74d4332a570e 100755 --- a/apps/communications/contacts/js/views/settings.js +++ b/apps/communications/contacts/js/views/settings.js @@ -460,6 +460,17 @@ contacts.Settings = (function() { var onOrderingChange = function onOrderingChange(evt) { newOrderByLastName = orderCheckBox.checked; updateOrderingUI(); + + // Execute operations if values got modified + if (newOrderByLastName != null && + newOrderByLastName != orderByLastName && contacts.List) { + contacts.List.setOrderByLastName(newOrderByLastName); + utils.cookie.update({order: newOrderByLastName}); + Cache.evict(); + // Force the reset of the dom, we know that we changed the order + contacts.List.load(null, true); + orderByLastName = newOrderByLastName; + } }; // Import contacts from SIM card and updates ui @@ -712,18 +723,8 @@ contacts.Settings = (function() { } }; - // Dismiss settings window and execute operations if values got modified + // Dismiss settings window var close = function close() { - if (newOrderByLastName != null && - newOrderByLastName != orderByLastName && contacts.List) { - contacts.List.setOrderByLastName(newOrderByLastName); - utils.cookie.update({order: newOrderByLastName}); - Cache.evict(); - // Force the reset of the dom, we know that we changed the order - contacts.List.load(null, true); - orderByLastName = newOrderByLastName; - } - Contacts.goBack(); };