Skip to content

Admin: Users page: function call wrong arguments #26234

Closed

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!

Activity

  1. added this to the milestone on Sep 29, 2016
  2. DeepDiver1975 commented on Sep 29, 2016

    @DeepDiver1975
    Contributor

    @PVince81 @butonic mind taking a look? THX

  3. PVince81 commented on Oct 4, 2016

    @PVince81
    Contributor

    Hmmmm nice catch. I do remember seeing that the sort was done over and over again I thought it was expected behavior but never noticed this arguments discrepancy.

    That's good, so this means there is potential to make this much faster. I'll have a look.

  4. PVince81 commented on Oct 5, 2016

    @PVince81
    Contributor

    Indeed, this is wrong. Let's do some git archeology to find out how it happened in the first place.

  5. PVince81 commented on Oct 5, 2016

    @PVince81
    Contributor

    Looks like it happened a long time ago in #12921 where the function signature was changed, but the call wasn't changed properly.

    Will fix.

  6. PVince81 commented on Oct 5, 2016

    @PVince81
    Contributor

    Fix is here #26282

  7. lock commented on Jul 31, 2019

    @lock

    This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

  8. locked as resolved and limited conversation to collaborators on Jul 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions