Просмотр исходного кода

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

AntonLV 6 лет назад
Родитель
Сommit
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. 
      */
-	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)
-			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)
     {
-    	$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)
             return array();
 
@@ -298,7 +308,7 @@ class BxBaseServiceConnections extends BxDol
 
         return array(
             'entry_sample' => '_sys_profile_sample_single',
-            'entry_url' => $oProfile->getUrl(),
+            'entry_url' => $oOwner->getUrl(),
             'entry_caption' => $oProfile->getDisplayName(),
             'entry_author' => $oProfile->id(),
             'lang_key' => $sLangKey,