Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-64412

messaging: helper::get_member_info() should respect input ordering

    XMLWordPrintable

    Details

      Description

      Some of the new messaging web services call the function helper::get_member_info to fetch user information. For example, api::get_user_contacts executes a query to fetch the ids of the contacts ordered by creation time and then calls helper::get_member_info to fetch the user information.

      This function takes a list of user ids, executes a SQL query and returns the records. But it returns the records in the order returned by the database and not the order of the passed user ids. Also the query has no ORDER BY so records are not returned in any meaningful order and the order is not consistent.

      This bug is difficult to reproduce because it depends on the behavior of the database, but it’s more likely to appear when using the limit from parameter. For example, in a site core_message_get_user_contacts(3, 0, 3) returns a list of users with order: 4, 5, 15. And core_message_get_user_contacts(3, 1, 3) returns a list of users with order: 4, 15, 17.

      This bug affects other functions that return a list of users: conversation members, contact requests, user search, etc.

       

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                11/Mar/19