Uploaded image for project: 'PUBLIC - Liferay Social Office Community Edition'
  1. PUBLIC - Liferay Social Office Community Edition
  2. SOS-920

Private Message Portlet pre-renders all users in the portal

    Details

    • Fix Priority:
      5
    • Caused by:
      Other (provide details)
    • Where was the bug?:
      Java, Javascript

      Description

      PrivateMessagingUtil has the following method:

      public static JSONArray getJSONRecipients(long userId)

      which gets all the users in Liferay, then returns them in a JSON formatted list

      The issue is that this is included in a JSP like this:

      <script>
      AUI().use('aui-autocomplete', function(A) {
      var sendList = A.one('#<portlet:namespace/>sendList');

      var autocomplete = new A.AutoComplete(
      {
      dataSource: <%= PrivateMessagingUtil.getJSONRecipients(user.getUserId()) %>,
      schema:

      { resultFields: ['name', 'classPk', 'classNameId'] }

      ,
      schemaType: 'json',
      matchKey: 'name',
      delimChar: ',',
      typeAhead: true,
      on: {
      itemSelect: function(sType, aArgs)

      { var name = aArgs.name; var classPk = aArgs.classPk; // the <li> element selected in the suggestion var classNameId = aArgs.classNameId; // object literal of data for the result sendList.val(sendList.val() + name + "|" + classPk + "|" + classNameId + ","); }

      },
      contentBox: '#<portlet:namespace/>autoCompleteContainer',
      input: '#<portlet:namespace/>to'
      }
      ).render();

      autocomplete.overlay.set('zIndex', 1002);
      });
      </script>

      Which, my client has 99000 users in their test env, and over 2 million in production. This should be something far more performant.

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                7 years, 30 weeks, 4 days ago

                Packages

                Version Package
                --Sprint - 07/12
                2.0.2 CE GA1
                2.1.X CE