PUBLIC - Liferay Portal Community Edition
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-26150

call to ChannelHubManagerUtil.deleteUserNotificiationEvent(themeDisplay.getCompanyId(), themeDisplay.getUserId(),userNotificationEventUuid) deletes all notification events with same uuid from all users

    Details

    • Liferay Contributor's Agreement:
      Accept
    • Similar Issues:
      Show 5 results 

      Description

      This method is called from "view-all-notifications" portlet.
      When one user deletes his notification event, all other notification events with same uuid sent to other users are deleted (even though user-id in the call is different).
      These notification events were created from the announcements.

      Tested on LR 61 git download 6.1.0-rc1-2524-gcc9fea4.zip from 06.03.

        Activity

        Hide
        Natasa Bulatovic added a comment -

        Additional explanation: such notifications are sent to site members (all have same uuid_, different user_ids corresponding to each member of the site)

        Show
        Natasa Bulatovic added a comment - Additional explanation: such notifications are sent to site members (all have same uuid_, different user_ids corresponding to each member of the site)
        Hide
        Natasa Bulatovic added a comment -

        OK, got it.. the issue was in the so-hook, package com.liferay.so.hook.service.impl
        file AnnouncementsEntryServiceImpl.java, method sendNotificationEvent

        below (commentted out false code) and added creation of new notification event for each user who is site member:
        =========

        protected void sendNotificationEvent(AnnouncementsEntry announcementEntry)
        throws PortalException, SystemException {

        JSONObject notificationEventJSONObject =
        JSONFactoryUtil.createJSONObject();

        notificationEventJSONObject.put("body", announcementEntry.getTitle());
        notificationEventJSONObject.put(
        "entryId", announcementEntry.getEntryId());
        notificationEventJSONObject.put(
        "groupId", announcementEntry.getClassPK());
        notificationEventJSONObject.put("portletId", PortletKeys.ANNOUNCEMENTS);
        notificationEventJSONObject.put("title", "x-sent-a-new-announcement");
        notificationEventJSONObject.put(
        "userId", announcementEntry.getUserId());

        /* NotificationEvent notificationEvent =
        NotificationEventFactoryUtil.createNotificationEvent(
        System.currentTimeMillis(), "6_WAR_soportlet",
        notificationEventJSONObject);

        notificationEvent.setDeliveryRequired(0);
        */
        List<User> users = Collections.emptyList();

        if (announcementEntry.getClassNameId() == 0)

        { users = UserLocalServiceUtil.getUsers( QueryUtil.ALL_POS, QueryUtil.ALL_POS); }

        else {
        String className = PortalUtil.getClassName(
        announcementEntry.getClassNameId());

        if (className.equals(Group.class.getName()))

        { users = UserLocalServiceUtil.getGroupUsers( announcementEntry.getClassPK()); }

        else if (className.equals(Organization.class.getName()))

        { users = UserLocalServiceUtil.getOrganizationUsers( announcementEntry.getClassPK()); }

        else if (className.equals(Role.class.getName()))

        { users = UserLocalServiceUtil.getRoleUsers( announcementEntry.getClassPK()); }

        else if (className.equals(UserGroup.class.getName()))

        { users = UserLocalServiceUtil.getUserGroupUsers( announcementEntry.getClassPK()); }

        }

        for (User user : users)

        { NotificationEvent notificationEvent = NotificationEventFactoryUtil.createNotificationEvent( System.currentTimeMillis(), "6_WAR_soportlet", notificationEventJSONObject); notificationEvent.setDeliveryRequired(0); ChannelHubManagerUtil.sendNotificationEvent( user.getCompanyId(), user.getUserId(), notificationEvent); }

        }

        }

        Show
        Natasa Bulatovic added a comment - OK, got it.. the issue was in the so-hook, package com.liferay.so.hook.service.impl file AnnouncementsEntryServiceImpl.java, method sendNotificationEvent below (commentted out false code) and added creation of new notification event for each user who is site member: ========= protected void sendNotificationEvent(AnnouncementsEntry announcementEntry) throws PortalException, SystemException { JSONObject notificationEventJSONObject = JSONFactoryUtil.createJSONObject(); notificationEventJSONObject.put("body", announcementEntry.getTitle()); notificationEventJSONObject.put( "entryId", announcementEntry.getEntryId()); notificationEventJSONObject.put( "groupId", announcementEntry.getClassPK()); notificationEventJSONObject.put("portletId", PortletKeys.ANNOUNCEMENTS); notificationEventJSONObject.put("title", "x-sent-a-new-announcement"); notificationEventJSONObject.put( "userId", announcementEntry.getUserId()); /* NotificationEvent notificationEvent = NotificationEventFactoryUtil.createNotificationEvent( System.currentTimeMillis(), "6_WAR_soportlet", notificationEventJSONObject); notificationEvent.setDeliveryRequired(0); */ List<User> users = Collections.emptyList(); if (announcementEntry.getClassNameId() == 0) { users = UserLocalServiceUtil.getUsers( QueryUtil.ALL_POS, QueryUtil.ALL_POS); } else { String className = PortalUtil.getClassName( announcementEntry.getClassNameId()); if (className.equals(Group.class.getName())) { users = UserLocalServiceUtil.getGroupUsers( announcementEntry.getClassPK()); } else if (className.equals(Organization.class.getName())) { users = UserLocalServiceUtil.getOrganizationUsers( announcementEntry.getClassPK()); } else if (className.equals(Role.class.getName())) { users = UserLocalServiceUtil.getRoleUsers( announcementEntry.getClassPK()); } else if (className.equals(UserGroup.class.getName())) { users = UserLocalServiceUtil.getUserGroupUsers( announcementEntry.getClassPK()); } } for (User user : users) { NotificationEvent notificationEvent = NotificationEventFactoryUtil.createNotificationEvent( System.currentTimeMillis(), "6_WAR_soportlet", notificationEventJSONObject); notificationEvent.setDeliveryRequired(0); ChannelHubManagerUtil.sendNotificationEvent( user.getCompanyId(), user.getUserId(), notificationEvent); } } }
        Hide
        Edward Gonzales added a comment -

        Hi Natasa! Thanks for reporting this bug. I have one requests - please test against Master to see if the bug still exists, else test against Milestone 5 (http://www.liferay.com/community/wiki/-/wiki/Main/BugSquad+-+Liferay+Portal+6.2+CE+Milestone+5+Testing). Thanks so much for providing a fix!

        Show
        Edward Gonzales added a comment - Hi Natasa! Thanks for reporting this bug. I have one requests - please test against Master to see if the bug still exists, else test against Milestone 5 ( http://www.liferay.com/community/wiki/-/wiki/Main/BugSquad+-+Liferay+Portal+6.2+CE+Milestone+5+Testing ). Thanks so much for providing a fix!

          People

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

            Dates

            • Created:
              Updated:
              Days since last comment:
              1 year, 43 weeks, 4 days ago

              Development

                Structure Helper Panel