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

Problem with "buddy.list.startegy" property: we can't see "friends" in chat portlet

    Details

    • Type: Bug
    • Status: Closed
    • Resolution: Fixed in LPS
    • Affects Version/s: 2.0.3 EE
    • Fix Version/s: 2.1.X EE
    • Labels:
    • Environment:
    • Fix Priority:
      4
    • Affects Portal Version/s:
      6.1.20 EE GA2

      Description

      https://www.liferay.com/group/customer/support/-/support/ticket/BOEGOLD-1

      By default, the "buddy.list.startegy" in the chat portlet is set to "all", so you can see all the people that are currently active in Social Office.
      But this we do not want in this environment, it should be shown only the people who you have as a friend.

      The Chat Portlet does not recognize that I have friends in Social Office and show me always nothing although some of my friends are currently online.

      Important note:
      When you apply Social Networking into a LR with SO, the portal starts sending friend requests from Summary portlet with a wrong connection type. It sends "1" (coworker) as a "type_" instead of "2" (friend), then it will be stored with the wrong value in the socialrelation table. It seems the types, defined in SocialRelationConstants.java will be messed up.

      Note 2: the customer's version is: SOCIAL OFFICE VERSION: 2.0.5!

      === Reproduction
      1a. Download/gather Social Office 2.0.5 or 2.1.0 either from Marketplace or use the latest Snapshot Release (LPKG) from https://svn.liferay.com/repos/private/support/snapshot-releases/social-office/2.1.0/
      1b. You need at least Chat & Contacts portlets

      2. Start 6.1.20 EE GA2
      3. Login with Test Test
      4. Register license for SO
      5. Deploy the plugins/LPKG

      6. Create a new User called "friend, friend@liferay.com"
      7. Set password for this user in order to login with him
      8. Go to Contacts Center on the Control Panel
      9. Click on "Add Connect" and add "friend" as a new connection

      (In the background, the SocialRequest will be created with type SocialRelationConstants.TYPE_BI_CONNECTION = 12)

      10. Login with "friend" from another browser
      11. Go to his "Public Page"
      12. Place "Requests" portlet on the page
      13. Confirm the request from "Test Test"

      (In the background, a new SocialRelation will be created with the type above, see the code snippet below

      contacts_portlet/contacts_center_toolbar.jsp
      // ... line 76
      
      	var contactsToolbarChildren = [];
      
      	contactsToolbarChildren.push(
      		new A.Button(
      			{
      				on: {
      					click: function(event) {
      						<portlet:namespace />relationAction(event, '<portlet:actionURL name="requestSocialRelation" windowState="<%= LiferayWindowState.NORMAL.toString() %>"><portlet:param name="type" value="<%= String.valueOf(SocialRelationConstants.TYPE_BI_CONNECTION) %>" /></portlet:actionURL>');
      					}
      				},
      				icon: 'icon-plus-sign',
      				id: '<portlet:namespace />addConnectionButton',
      				label: '<%= UnicodeLanguageUtil.get(pageContext, "connect") %>',
      				render: true,
      				visible: <%= showAddAsConnectionButton %>
      			}
      		)
      	);
      
      

      14. Assert the both users are able to see each other on the Chat Portlet

      15. Stop portal
      16. Go to [$TOMCAT_HOME]/webapps/chat-portlet/WEB-INF/classes
      17. Open "portlet.properties"
      18. Change

      buddy.list.strategy=all

      to

      buddy.list.strategy=friends

      then save, close.

      19. Start portal
      20. Login in with both users

      Observed behavior
      Users are not able to see each other anymore.

      === Technical background
      When the buddy strategy is set to "friends", we try to retrieve friends with SocialRelation type SocialRelationConstants.TYPE_BI_FRIEND in

      DefaultBuddyFinderImpl.getBuddies
      // ...
      		else if (PortletPropsValues.BUDDY_LIST_STRATEGY.equals("friends")) {
      			buddies = StatusLocalServiceUtil.getSocialStatuses(
      				userId, SocialRelationConstants.TYPE_BI_FRIEND, modifiedDate, 0,
      				PortletPropsValues.BUDDY_LIST_MAX_BUDDIES);
      
      

      That causes the problem.

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                5 years, 22 weeks ago

                Packages

                Version Package
                2.1.X EE