1
0
mirror of https://github.com/bitwarden/desktop.git synced 2024-11-02 08:30:14 +01:00

fix this reference to sort method

This commit is contained in:
Kyle Spearrin 2017-08-30 08:43:06 -04:00
parent ae6c609c91
commit de097eaacf

View File

@ -497,7 +497,28 @@ function initLoginService() {
return deferred.promise;
};
LoginService.prototype.sortLoginsByLastUsed = function (a, b) {
LoginService.prototype.sortLoginsByLastUsed = sortLoginsByLastUsed;
LoginService.prototype.sortLoginsByLastUsedThenName = function (a, b) {
var result = sortLoginsByLastUsed(a, b);
if (result !== 0) {
return result;
}
var nameA = (a.name + '_' + a.username).toUpperCase();
var nameB = (b.name + '_' + b.username).toUpperCase();
if (nameA < nameB) {
return -1;
}
if (nameA > nameB) {
return 1;
}
return 0;
};
function sortLoginsByLastUsed(a ,b) {
var aLastUsed = a.localData && a.localData.lastUsedDate ? a.localData.lastUsedDate : null;
var bLastUsed = b.localData && b.localData.lastUsedDate ? b.localData.lastUsedDate : null;
@ -516,27 +537,8 @@ function initLoginService() {
}
return 0;
};
LoginService.prototype.sortLoginsByLastUsedThenName = function (a, b) {
var result = this.sortLoginsByLastUsed(a, b);
if (result !== 0) {
return result;
}
var nameA = (a.name + '_' + a.username).toUpperCase();
var nameB = (b.name + '_' + b.username).toUpperCase();
if (nameA < nameB) {
return -1;
}
if (nameA > nameB) {
return 1;
}
return 0;
};
function handleError(error, deferred) {
deferred.reject(error);
}