Ver código fonte

Ticket #4640 - Timeline: Update necessary data when content was moved to another author.

AntonLV 2 anos atrás
pai
commit
102f7c9dfe

+ 13 - 4
modules/boonex/channels/classes/BxCnlModule.php

@@ -31,9 +31,9 @@ class BxCnlModule extends BxBaseModGroupsModule
      * @param string $sHashtag - hashtag to be processed.
      * @param string $sHashtag - hashtag to be processed.
      * @param string $sModuleName - module name.
      * @param string $sModuleName - module name.
      * @param integer $iContentId - ID of the content which has the hashtag.
      * @param integer $iContentId - ID of the content which has the hashtag.
-     * @param integer $iAuthorId - action's author id.
+     * @param integer $iSenderId - action's sender (author) id.
      */
      */
-    function processHashtag($sHashtag, $sModuleName, $iContentId, $iAuthorId = 0)
+    function processHashtag($sHashtag, $sModuleName, $iContentId, $iSenderId = 0)
     {
     {
         $CNF = &$this->_oConfig->CNF;
         $CNF = &$this->_oConfig->CNF;
 
 
@@ -47,11 +47,20 @@ class BxCnlModule extends BxBaseModGroupsModule
             return;
             return;
 
 
         /*
         /*
+         * Ticket #4640
+         * 
+         * Before: 
          * Use content's author profile when Author ID wasn't provided. 
          * Use content's author profile when Author ID wasn't provided. 
          * Usually it happens when tags were processed with cron.
          * Usually it happens when tags were processed with cron.
+         * 
+         * After:
+         * Use content's author profile every time when it's possible. Otherwise use sender from alert.
          */
          */
-        if(empty($iAuthorId))
-            $iAuthorId = abs(BxDolService::call($sModuleName, 'get_author', array($iContentId)));
+        $iAuthorId = 0;
+        if(($sModuleMethod = 'get_author') && bx_is_srv($sModuleName, $sModuleMethod))
+            $iAuthorId = abs(bx_srv($sModuleName, $sModuleMethod, [$iContentId]));
+        if(empty($iAuthorId) && !empty($iSenderId))
+            $iAuthorId = $iSenderId;
 
 
         $aCheck = checkActionModule($iAuthorId, 'create channel auto', $this->getName(), false);
         $aCheck = checkActionModule($iAuthorId, 'create channel auto', $this->getName(), false);
         $mixedCnlId = $this->_oDb->getChannelIdByName($sHashtag);
         $mixedCnlId = $this->_oDb->getChannelIdByName($sHashtag);

+ 1 - 1
modules/boonex/timeline/classes/BxTimelineResponse.php

@@ -111,7 +111,7 @@ class BxTimelineResponse extends BxBaseModNotificationsResponse
                 $aEvent = $this->$sMethod($oAlert, $aHandler);
                 $aEvent = $this->$sMethod($oAlert, $aHandler);
                 if(empty($aEvent) || !is_array($aEvent))
                 if(empty($aEvent) || !is_array($aEvent))
                     break;
                     break;
-//var_dump($oAlert->aExtras); exit;
+
                 $aContent = [];
                 $aContent = [];
                 if(!empty($aEvent['content']) && is_string($aEvent['content']))
                 if(!empty($aEvent['content']) && is_string($aEvent['content']))
                     $aContent = unserialize($aEvent['content']);
                     $aContent = unserialize($aEvent['content']);