Skip to content

Commit aaf95e9

Browse files
committed
Improved contacts sorting internal logic
1 parent 332867e commit aaf95e9

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

js/Settings.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,12 @@ module.exports = {
8080
return {
8181
Allow: config.Allow ? true : false,
8282
DisplayOptions: config.DisplayOptions || [],
83-
DefaultSortBy: config.DefaultSortBy && config.Allow ? config.DefaultSortBy : 'Name',
84-
DefaultSortOrder: config.DefaultSortOrder && config.Allow ? config.DefaultSortOrder : 'Desc'
83+
DefaultSortBy: config.Allow ?
84+
Types.pEnum(Enums.ContactSortField[config.DefaultSortBy], Enums.ContactSortField, Enums.ContactSortField.Name) :
85+
Enums.ContactSortField.Filename,
86+
DefaultSortOrder: config.Allow ?
87+
Types.pEnum(Enums.SortOrder[config.DefaultSortOrder], Enums.SortOrder, Enums.SortOrder.Desc) :
88+
Enums.SortOrder.Desc
8589
};
8690
}
8791
};

js/views/CContactsView.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -215,10 +215,6 @@ function CContactsView()
215215

216216
this.bSortEnabled = Settings.ContactsSortBy && Settings.ContactsSortBy.Allow
217217
&& Settings.ContactsSortBy.DisplayOptions && Settings.ContactsSortBy.DisplayOptions.length > 0;
218-
219-
// Had to set it here because in Setting.init not all Enums are defined
220-
Settings.ContactsSortBy.DefaultSortBy = Enums.ContactSortField[Settings.ContactsSortBy.DefaultSortBy];
221-
Settings.ContactsSortBy.DefaultSortOrder = Enums.SortOrder[Settings.ContactsSortBy.DefaultSortOrder];
222218

223219
this.sortBy = ko.observable(Settings.ContactsSortBy.DefaultSortBy);
224220
this.sortOrder = ko.observable(Settings.ContactsSortBy.DefaultSortOrder);

0 commit comments

Comments
 (0)