summaryrefslogtreecommitdiffstats
path: root/settings/js
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@owncloud.com>2015-06-11 17:57:00 +0200
committerJoas Schilling <nickvergessen@owncloud.com>2015-06-16 11:10:00 +0200
commit171f86ca2e71918809930e823062d93c03833921 (patch)
treef605b2fa0d94a78c44d9781c595331f1e8a34b52 /settings/js
parentfee62ac61c1cecb37e283fc6f9faf0251389226f (diff)
downloadnextcloud-server-171f86ca2e71918809930e823062d93c03833921.tar.gz
nextcloud-server-171f86ca2e71918809930e823062d93c03833921.zip
Only sort by group name when LDAP is involved
Diffstat (limited to 'settings/js')
-rw-r--r--settings/js/users/groups.js31
1 files changed, 27 insertions, 4 deletions
diff --git a/settings/js/users/groups.js b/settings/js/users/groups.js
index d5e37ff8d63..d205e915508 100644
--- a/settings/js/users/groups.js
+++ b/settings/js/users/groups.js
@@ -5,7 +5,8 @@
* See the COPYING-README file.
*/
-var $userGroupList;
+var $userGroupList,
+ $sortGroupBy;
var GroupList;
GroupList = {
@@ -27,6 +28,11 @@ GroupList = {
},
setUserCount: function (groupLiElement, usercount) {
+ if ($sortGroupBy !== 1) {
+ // If we don't sort by group count we dont display them either
+ return;
+ }
+
var $groupLiElement = $(groupLiElement);
if (usercount === undefined || usercount === 0 || usercount < 0) {
usercount = '';
@@ -77,6 +83,19 @@ GroupList = {
return 1;
}
+ if ($sortGroupBy === 1) {
+ // Sort by user count first
+ var $usersGroupA = $(a).data('usercount'),
+ $usersGroupB = $(b).data('usercount');
+ if ($usersGroupA > 0 && $usersGroupA > $usersGroupB) {
+ return -1;
+ }
+ if ($usersGroupB > 0 && $usersGroupB > $usersGroupA) {
+ return 1;
+ }
+ }
+
+ // Fallback or sort by group name
return UserList.alphanum(
$(a).find('a span').text(),
$(b).find('a span').text()
@@ -127,7 +146,8 @@ GroupList = {
OC.generateUrl('/settings/users/groups'),
{
pattern: filter.getPattern(),
- filterGroups: filter.filterGroups ? 1 : 0
+ filterGroups: filter.filterGroups ? 1 : 0,
+ sortGroups: $sortGroupBy
},
function (result) {
@@ -285,8 +305,11 @@ GroupList = {
$(document).ready( function () {
$userGroupList = $('#usergrouplist');
GroupList.initDeleteHandling();
- // TODO: disabled due to performance issues
- // GroupList.getEveryoneCount();
+ $sortGroupBy = $userGroupList.data('sort-groups');
+ if ($sortGroupBy === 1) {
+ // Disabled due to performance issues, when we don't need it for sorting
+ GroupList.getEveryoneCount();
+ }
// Display or hide of Create Group List Element
$('#newgroup-form').hide();