Переглянути джерело

Ticket #2392 - Point №1: Befriend and Follow.

AntonLV 6 роки тому
батько
коміт
6865778bdd
1 змінених файлів з 25 додано та 15 видалено
  1. 25 15
      template/scripts/BxBaseServiceConnections.php

+ 25 - 15
template/scripts/BxBaseServiceConnections.php

@@ -266,20 +266,25 @@ class BxBaseServiceConnections extends BxDol
     /*
     /*
      * Get notification data for Notifications module - action Subscribe. 
      * Get notification data for Notifications module - action Subscribe. 
      */
      */
-	public function serviceGetNotificationsPost($aEvent)
+    public function serviceGetNotificationsPost($aEvent)
     {
     {
-    	$iProfile = (int)$aEvent['object_id'];
-    	$oProfile = BxDolProfile::getInstance($iProfile);
+        $iOwner = (int)$aEvent['owner_id'];
+        $oOwner = BxDolProfile::getInstance($iOwner);
+        if(!$oOwner)
+            return array();
+
+        $iProfile = (int)$aEvent['object_id'];
+        $oProfile = BxDolProfile::getInstance($iProfile);
         if(!$oProfile)
         if(!$oProfile)
-			return array();
-
-		return array(
-			'entry_sample' => '_sys_profile_sample_single',
-			'entry_url' => $oProfile->getUrl(),
-			'entry_caption' => $oProfile->getDisplayName(),
-			'entry_author' => $oProfile->id(),
-			'lang_key' => '_sys_profile_subscription_added',
-		);
+            return array();
+
+        return array(
+            'entry_sample' => '_sys_profile_sample_single',
+            'entry_url' => $oOwner->getUrl(),
+            'entry_caption' => $oProfile->getDisplayName(),
+            'entry_author' => $oProfile->id(),
+            'lang_key' => '_sys_profile_subscription_added',
+        );
     }
     }
 
 
     /*
     /*
@@ -287,8 +292,13 @@ class BxBaseServiceConnections extends BxDol
      */
      */
     public function serviceGetNotificationsPostFriendship($aEvent)
     public function serviceGetNotificationsPostFriendship($aEvent)
     {
     {
-    	$iProfile = (int)$aEvent['object_id'];
-    	$oProfile = BxDolProfile::getInstance($iProfile);
+        $iOwner = (int)$aEvent['owner_id'];
+        $oOwner = BxDolProfile::getInstance($iOwner);
+        if(!$oOwner)
+            return array();
+
+        $iProfile = (int)$aEvent['object_id'];
+        $oProfile = BxDolProfile::getInstance($iProfile);
         if(!$oProfile)
         if(!$oProfile)
             return array();
             return array();
 
 
@@ -298,7 +308,7 @@ class BxBaseServiceConnections extends BxDol
 
 
         return array(
         return array(
             'entry_sample' => '_sys_profile_sample_single',
             'entry_sample' => '_sys_profile_sample_single',
-            'entry_url' => $oProfile->getUrl(),
+            'entry_url' => $oOwner->getUrl(),
             'entry_caption' => $oProfile->getDisplayName(),
             'entry_caption' => $oProfile->getDisplayName(),
             'entry_author' => $oProfile->id(),
             'entry_author' => $oProfile->id(),
             'lang_key' => $sLangKey,
             'lang_key' => $sLangKey,