Skip to content

Admin: Users page: function call wrong arguments #26234

@LeonardoRM

Description

@LeonardoRM

Steps to reproduce

  1. As admin, go to users page.
  2. May take a long time to process the initialUsersToLoad.

Expected behaviour

Load in a reasonable time.

Actual behaviour

Makes browser to show the 'slow script' warning.

Server configuration

Operating system: Debian jessie

Web server: apache2-2.4.10

Database: mariadb-server-10.0.23

PHP version: 5.6

ownCloud version: 9.0.0 (but code provided is the same in master)

Are you using an external user-backend, if yes which one: IMAP

Client configuration

Browser: Firefox 49

Operating system: kubuntu 14.04

Hello guys!
If you see this file, there's a function call with arguments that I think don't match and are interpreted incorrectly. The file is settings/js/users/users.js

L399:

var $tr = UserList.add(user, user.lastLogin, false, user.backend);

L52:

add: function (user, sort) {

L174:

if (sort) {
    UserList.doSort();
}

So, this is what I think is happening:
L399 calls the function add with 2nd to 4th parameters not corresponding with the ones add expects. 2nd and 4th arguments are already included in user object, so there's no need for those. And 3rd argument (false) seems to be the one expected as sort in definition of function add.

L174, within function add, checks sort which is an integer (corresponding to user.lastLogin) and the if condition goes true, doing the sort every time there's a call to add.

I did a quick workaround changing L174 with this:
if (sort===true) {
to prevent taking an integer as true.

Does it make any sense?
Thanks!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions