]> source.dussan.org Git - nextcloud-server.git/commitdiff
tidy up adding user to list a little bit 1701/head
authorArthur Schiwon <blizzz@arthur-schiwon.de>
Tue, 11 Oct 2016 10:41:19 +0000 (12:41 +0200)
committerArthur Schiwon <blizzz@arthur-schiwon.de>
Tue, 11 Oct 2016 10:41:19 +0000 (12:41 +0200)
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
settings/js/users/users.js

index 271188875daf0f612c3f1613824695c161f76e9c..d25f9d92db2b6c5c8be9452f3829eb82ffed4c85 100644 (file)
@@ -48,10 +48,8 @@ var UserList = {
         *                              'email':                        'username@example.org'
         *                              'isRestoreDisabled':false
         *                      }
-        * @param sort
-        * @returns table row created for this user
         */
-       add: function (user, sort) {
+       add: function (user) {
                if (this.currentGid && this.currentGid !== '_everyone' && _.indexOf(user.groups, this.currentGid) < 0) {
                        return;
                }
@@ -170,20 +168,12 @@ var UserList = {
                        UserList.checkUsersToLoad();
                }
 
-               /**
-                * sort list
-                */
-               if (sort) {
-                       UserList.doSort();
-               }
-
                $quotaSelect.on('change', UserList.onQuotaSelect);
 
                // defer init so the user first sees the list appear more quickly
                window.setTimeout(function(){
                        $quotaSelect.singleSelect();
                }, 0);
-               return $tr;
        },
        // From http://my.opera.com/GreyWyvern/blog/show.dml/1671288
        alphanum: function(a, b) {
@@ -389,8 +379,6 @@ var UserList = {
                        OC.generateUrl('/settings/users/users'),
                        { offset: UserList.offset, limit: limit, gid: gid, pattern: pattern },
                        function (result) {
-                               var loadedUsers = 0;
-                               var trs = [];
                                //The offset does not mirror the amount of users available,
                                //because it is backend-dependent. For correct retrieval,
                                //always the limit(requested amount of users) needs to be added.
@@ -398,9 +386,7 @@ var UserList = {
                                        if(UserList.has(user.name)) {
                                                return true;
                                        }
-                                       var $tr = UserList.add(user, false);
-                                       trs.push($tr);
-                                       loadedUsers++;
+                                       UserList.add(user);
                                });
                                if (result.length > 0) {
                                        UserList.doSort();
@@ -867,7 +853,8 @@ $(document).ready(function () {
                                                }
                                        }
                                        if(!UserList.has(username)) {
-                                               UserList.add(result, true);
+                                               UserList.add(result);
+                                               UserList.doSort();
                                        }
                                        $('#newusername').focus();
                                        GroupList.incEveryoneCount();