mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-05-30 15:45:26 +00:00
(js) Fix possible errors (help from jsjint)
This commit is contained in:
@@ -161,7 +161,7 @@
|
||||
if (!user.wasSubscribed && user.isSubscribed) {
|
||||
users.push(user.uid);
|
||||
// console.debug('subscribe ' + user.uid);
|
||||
};
|
||||
}
|
||||
});
|
||||
if (users.length) {
|
||||
param = {uids: users.join(',')};
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
/* JavaScript for Authentication */
|
||||
|
||||
(function() {
|
||||
/* jshint validthis: true */
|
||||
'use strict';
|
||||
|
||||
angular.module('SOGo.Authentication', [])
|
||||
@@ -41,7 +42,7 @@
|
||||
start++;
|
||||
if (start > 0)
|
||||
currentPair = currentPair.substr(start);
|
||||
if (currentPair.indexOf(prefix) == 0)
|
||||
if (currentPair.indexOf(prefix) === 0)
|
||||
foundCookie = currentPair.substr(prefix.length);
|
||||
}
|
||||
|
||||
@@ -77,12 +78,11 @@
|
||||
parts = baseAddress.split('/');
|
||||
parts.splice(0, 3);
|
||||
altBaseAddress = parts.join('/');
|
||||
newAddress;
|
||||
if ((address.startsWith(baseAddress)
|
||||
|| address.startsWith(altBaseAddress))
|
||||
&& !address.endsWith('/logoff')) {
|
||||
if ((address.startsWith(baseAddress) || address.startsWith(altBaseAddress)) &&
|
||||
!address.endsWith('/logoff')) {
|
||||
newAddress = address;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
newAddress = baseAddress;
|
||||
}
|
||||
|
||||
@@ -91,8 +91,9 @@
|
||||
|
||||
this.$get = getService;
|
||||
|
||||
getService.$inject = ['$q', '$http', 'passwordPolicyConfig']
|
||||
getService.$inject = ['$q', '$http', 'passwordPolicyConfig'];
|
||||
function getService($q, $http, passwordPolicyConfig) {
|
||||
|
||||
var _this = this, service;
|
||||
|
||||
service = {
|
||||
@@ -183,7 +184,7 @@
|
||||
d.resolve();
|
||||
}).error(function(data, status) {
|
||||
var error,
|
||||
perr = data["LDAPPasswordPolicyError"];
|
||||
perr = data.LDAPPasswordPolicyError;
|
||||
|
||||
if (!perr) {
|
||||
perr = passwordPolicyConfig.PolicyPasswordSystemUnknown;
|
||||
|
||||
@@ -90,11 +90,11 @@
|
||||
scope.cancel = function() {
|
||||
d.reject();
|
||||
$mdDialog.hide();
|
||||
}
|
||||
};
|
||||
scope.ok = function() {
|
||||
d.resolve(scope.name);
|
||||
$mdDialog.hide();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
return d.promise;
|
||||
@@ -110,7 +110,7 @@
|
||||
angular.extend(Dialog, { $q: $q , $modal: $mdDialog });
|
||||
|
||||
return Dialog; // return constructor
|
||||
};
|
||||
}
|
||||
|
||||
/* Factory registration in Angular module */
|
||||
angular
|
||||
|
||||
@@ -21,8 +21,9 @@
|
||||
}
|
||||
hash = email.md5();
|
||||
|
||||
// return 'https://www.gravatar.com/avatar/' + hash + '?s=' + s + '&d=identicon';
|
||||
return 'https://www.gravatar.com/avatar/' + hash + '?s=' + s + '&d=wavatar';
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
angular
|
||||
|
||||
@@ -59,7 +59,10 @@
|
||||
User.$query = search;
|
||||
|
||||
return User.$$resource.fetch(null, 'usersSearch', param).then(function(response) {
|
||||
var results, index, user;
|
||||
var results, index, user,
|
||||
compareUids = function(data) {
|
||||
return user.uid == data.uid;
|
||||
};
|
||||
if (excludedUsers) {
|
||||
// Remove excluded users from response
|
||||
results = _.filter(response.users, function(data) {
|
||||
@@ -84,9 +87,7 @@
|
||||
// Remove users that no longer match the search query
|
||||
for (index = User.$users.length - 1; index >= 0; index--) {
|
||||
user = User.$users[index];
|
||||
if (!_.find(results, function(data) {
|
||||
return user.uid == data.uid;
|
||||
})) {
|
||||
if (!_.find(results, compareUids)) {
|
||||
User.$users.splice(index, 1);
|
||||
}
|
||||
}
|
||||
@@ -109,10 +110,6 @@
|
||||
this.$$image = this.image || User.$gravatar(this.c_email);
|
||||
};
|
||||
|
||||
User.prototype.toString = function() {
|
||||
return '[User ' + this.c_email + ']';
|
||||
};
|
||||
|
||||
/**
|
||||
* @function $shortFormat
|
||||
* @memberof User.prototype
|
||||
@@ -276,4 +273,8 @@
|
||||
return user;
|
||||
};
|
||||
|
||||
User.prototype.toString = function() {
|
||||
return '[User ' + this.c_email + ']';
|
||||
};
|
||||
|
||||
})();
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
$timeout(function() {
|
||||
$rootScope.$broadcast('sgFocusOn', name);
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
angular
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
' }',
|
||||
'</style>'
|
||||
].join('')
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
angular
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/* -*- Mode: javascript; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
|
||||
(function() {
|
||||
/* jshint validthis: true */
|
||||
'use strict';
|
||||
|
||||
/*
|
||||
@@ -66,7 +67,7 @@
|
||||
if (buttonEl && compiledButtonEl) {
|
||||
compiledButtonEl.on('click', controller.cancelSearch);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,7 +84,7 @@
|
||||
transclude(function(clone) {
|
||||
iElement.append(clone);
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,9 +110,9 @@
|
||||
|
||||
// Method to call on data changes
|
||||
vm.onChange = function() {
|
||||
if (vm.searchText != null) {
|
||||
if (vm.searchText !== null) {
|
||||
if (vm.searchText != vm.previous.searchText || vm.searchField != vm.previous.searchField) {
|
||||
if (vm.searchText.length > 2 || vm.searchText.length == 0) {
|
||||
if (vm.searchText.length > 2 || vm.searchText.length === 0) {
|
||||
// doSearch is the compiled expression of the sg-search attribute
|
||||
vm.doSearch($scope, { searchText: vm.searchText, searchField: vm.searchField });
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/* -*- Mode: javascript; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
|
||||
(function() {
|
||||
/* jshint validthis: true */
|
||||
'use strict';
|
||||
|
||||
/*
|
||||
@@ -27,7 +28,12 @@
|
||||
controller: sgSubscribeDialogController,
|
||||
controllerAs: 'vm',
|
||||
link: link
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function link(scope, element, attrs, controller) {
|
||||
var inputEl = element.find('input');
|
||||
element.on('click', controller.showDialog);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -85,12 +91,6 @@
|
||||
};
|
||||
}
|
||||
|
||||
function link(scope, element, attrs, controller) {
|
||||
var inputEl = element.find('input');
|
||||
element.on('click', controller.showDialog);
|
||||
}
|
||||
|
||||
|
||||
angular
|
||||
.module('SOGo.Common')
|
||||
.directive('sgSubscribe', sgSubscribe);
|
||||
|
||||
@@ -29,7 +29,8 @@
|
||||
i,
|
||||
modelDays,
|
||||
modelAttr,
|
||||
ensureInitRunsOnce;
|
||||
ensureInitRunsOnce,
|
||||
toggleClass;
|
||||
|
||||
ensureInitRunsOnce = scope.$watch(function() {
|
||||
// Parse attribute until it returns a valid object
|
||||
@@ -51,18 +52,20 @@
|
||||
ensureInitRunsOnce();
|
||||
}
|
||||
});
|
||||
|
||||
for (i = 0; i < tiles.length; i++) {
|
||||
tile = angular.element(tiles[i]);
|
||||
tile.addClass('iconButton');
|
||||
tile.find('figure').addClass('md-icon');
|
||||
tile.on('click', function() {
|
||||
|
||||
toggleClass = function() {
|
||||
// Toggle class on click event and call toggle function
|
||||
var tile = angular.element(this),
|
||||
day = tile.attr('value');
|
||||
tile.toggleClass('sg-active');
|
||||
toggle(day);
|
||||
});
|
||||
};
|
||||
|
||||
for (i = 0; i < tiles.length; i++) {
|
||||
tile = angular.element(tiles[i]);
|
||||
tile.addClass('iconButton');
|
||||
tile.find('figure').addClass('md-icon');
|
||||
tile.on('click', toggleClass);
|
||||
}
|
||||
|
||||
function toggle(day) {
|
||||
|
||||
Reference in New Issue
Block a user