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

Merge branch 'master' of https://github.com/unacms/una

AntonLV 1 год назад
Родитель
Сommit
65863972cf

+ 25 - 22
inc/classes/BxDolConnection.php

@@ -372,6 +372,30 @@ class BxDolConnection extends BxDolFactory implements iBxDolFactoryObject
         $this->checkAllowedConnect ($iInitiator, $iContent, true, $iMutual, false);
 
         $bMutual = false;
+        
+        /**
+         * Call socket.
+         */
+        if(($oSockets = BxDolSockets::getInstance()) && $oSockets->isEnabled()){
+            $aMessageInitiator = $aMessageContent = [
+                'object' => $this->_sObject, 
+                'action' => 'added',
+            ];
+
+            if(bx_is_api()) {
+                $aMessageInitiator = array_merge($aMessageInitiator, [
+                    'user' => BxDolProfile::getDataForPage($iInitiator)
+                ]);
+
+                $aMessageContent = array_merge($aMessageContent, [
+                    'user' => BxDolProfile::getDataForPage($iContent)
+                ]);
+            }
+
+            $oSockets->sendEvent('sys_connections', $iInitiator , 'changed', json_encode($aMessageInitiator));
+            $oSockets->sendEvent('sys_connections', $iContent , 'changed', json_encode($aMessageContent));
+        }
+        
         if($this->_aObject['type'] == BX_CONNECTIONS_TYPE_ONE_WAY || ($bMutual = ($this->_aObject['type'] == BX_CONNECTIONS_TYPE_MUTUAL && $iMutual))) {
             $oProfileQuery = BxDolProfileQuery::getInstance();
 
@@ -390,28 +414,7 @@ class BxDolConnection extends BxDolFactory implements iBxDolFactoryObject
                     BxDolRecommendation::updateData($iContent);
             }
 
-            /**
-             * Call socket.
-             */
-            if(($oSockets = BxDolSockets::getInstance()) && $oSockets->isEnabled()){
-                $aMessageInitiator = $aMessageContent = [
-                    'object' => $this->_sObject, 
-                    'action' => 'added',
-                ];
-
-                if(bx_is_api()) {
-                    $aMessageInitiator = array_merge($aMessageInitiator, [
-                        'user' => BxDolProfile::getDataForPage($iInitiator)
-                    ]);
-
-                    $aMessageContent = array_merge($aMessageContent, [
-                        'user' => BxDolProfile::getDataForPage($iContent)
-                    ]);
-                }
-
-                $oSockets->sendEvent('sys_connections', $iInitiator , 'changed', json_encode($aMessageInitiator));
-                $oSockets->sendEvent('sys_connections', $iContent , 'changed', json_encode($aMessageContent));
-            }
+            
         }
     }
 

+ 2 - 1
inc/classes/BxDolProfile.php

@@ -182,7 +182,6 @@ class BxDolProfile extends BxDolFactory implements iBxDolProfile
             'operator' => isAdmin(),
             //'info' => $oProfile->getInfo(),
             'confirmed' => $oAccount->isConfirmed(),
-            'counters' => bx_srv('system', 'profile_counters', [], 'TemplServiceProfiles'),
             'profiles_count' => $oAccount->getProfilesNumber(true),
             'hash' => encryptUserId($iId),
             'profiles_limit' => (int)getParam('sys_account_limit_profiles_number'),
@@ -191,6 +190,8 @@ class BxDolProfile extends BxDolFactory implements iBxDolProfile
         ];
         
         if ($iId == bx_get_logged_profile_id()){
+            $aRv['counters'] = bx_srv('system', 'profile_counters', [], 'TemplServiceProfiles');
+            
             $oInformer = BxDolInformer::getInstance(BxDolTemplate::getInstance());
             $sRet = $oInformer ? $oInformer->display() : '';
             if ($sRet){

+ 2 - 2
modules/boonex/notifications/classes/BxNtfsModule.php

@@ -256,8 +256,8 @@ class BxNtfsModule extends BxBaseModNotificationsModule
                 $aParams['start'] = end($aContent)['id'];
             }
 
-            if($aParams['start'] == 0)
-                $this->markAsRead($iOwnerId, $aParams);
+            //if($aParams['start'] == 0)
+            //    $this->markAsRead($iOwnerId, $aParams);
 
             return [bx_api_get_block('browse', [
                 'unit' => 'notifications',  

+ 1 - 1
template/scripts/BxBaseMenuProfileFollowings.php

@@ -88,7 +88,7 @@ class BxBaseMenuProfileFollowings extends BxTemplMenu
         if(!$iPerPage)
             $iPerPage = $this->_iPerPageDefault;
 
-        $aIds = $this->_oConnection->getConnectedContentByType($iProfile, [$sContextModule], false, $iStart, $iPerPage + 1);
+        $aIds = $this->_oConnection->getConnectedContentByType($iProfile, [$sContextModule], false, $iStart, $iPerPage + 1, BX_CONNECTIONS_ORDER_ADDED_DESC);
 
         $bNext = false;
         if(count($aIds) > $iPerPage) {