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

Ticket #5019 - Contexts: Improve invite/join.

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

+ 8 - 1
modules/base/groups/classes/BxBaseModGroupsModule.php

@@ -213,7 +213,14 @@ class BxBaseModGroupsModule extends BxBaseModProfileModule
     {
         return _t($this->_oConfig->CNF['T']['txt_sample_single']);
     }
-    
+
+    public function serviceGetFansConnectionObject()
+    {
+        $CNF = &$this->_oConfig->CNF;
+
+        return ($sKey = 'OBJECT_CONNECTIONS') && !empty($CNF[$sKey]) && ($oConnection = BxDolConnection::getObjectInstance($CNF[$sKey])) !== false ? $oConnection : false;
+    }
+
     /**
      * @see iBxDolProfileService::serviceGetParticipatingProfiles
      */ 

+ 2 - 2
modules/boonex/invites/classes/BxInvModule.php

@@ -698,8 +698,8 @@ class BxInvModule extends BxDolModule
         $bAutoJoin = $this->_oConfig->isContextAutoJoin();
 
         $bResult = false;
-        if($bAutoJoin)
-            $bResult = bx_srv($sContext, 'add_mutual_connection', [$iContextPid, $iPid]);
+        if($bAutoJoin && ($oConnection = bx_srv($sContext, 'get_fans_connection_object')) !== false)
+            $bResult = $oConnection->addConnection($iContextPid, $iPid) && $oConnection->addConnection($iPid, $iContextPid);
 
         if(!$bAutoJoin || !$bResult)
             $bResult = bx_srv($sContext, 'add_invitation', [$iContextPid, $iPid]);