Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Bug 1197072 - Fix changing sort by last name when the user kills app #33533

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions apps/communications/contacts/js/views/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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();
};

Expand Down