ソースを参照

Ticket #5653 - Notifications: Improve grouping for notifications with the same source. Related changes.

AntonLV 1 ヶ月 前
親
コミット
942d4e5e36
2 ファイル変更、26 行追加、12 行削除
  1. 17 12
      inc/classes/BxDolCmts.php
  2. 9 0
      modules/boonex/tasks/classes/BxTasksCmts.php

+ 17 - 12
inc/classes/BxDolCmts.php

@@ -1580,7 +1580,7 @@ class BxDolCmts extends BxDolFactory implements iBxDolReplaceable, iBxDolContent
          *      - `cf` - [int] comment's audience filter value
          * @hook @ref hook-bx_dol_comment-commentRemoved
          */
-        bx_alert($this->_sSystem, 'commentRemoved', $iObjId, $iPerformerId, $aAlertParams);
+        $this->_callAlert($this->_sSystem, 'commentRemoved', $iObjId, $iPerformerId, $aAlertParams);
         
         /**
          * @hooks
@@ -1589,7 +1589,7 @@ class BxDolCmts extends BxDolFactory implements iBxDolReplaceable, iBxDolContent
          * except 'comment id' is provided in $object_id
          * @hook @ref hook-comment-deleted
          */
-        bx_alert('comment', 'deleted', $iCmtId, $iPerformerId, $aAlertParams);
+        $this->_callAlert('comment', 'deleted', $iCmtId, $iPerformerId, $aAlertParams);
 
         if(!empty($iCmtPrntId)) {
             $aCmtPrnt = $this->_oQuery->getCommentSimple($iObjId, $iCmtPrntId);
@@ -1619,7 +1619,7 @@ class BxDolCmts extends BxDolFactory implements iBxDolReplaceable, iBxDolContent
                  *      - `privacy_view` - [int] or [string] privacy for view comment action, @see BxDolPrivacy
                  * @hook @ref hook-bx_dol_comment-replyRemoved
                  */
-                bx_alert($this->_sSystem, 'replyRemoved', $iCmtPrntId, $iPerformerId, $aAlertParamsReply);
+                $this->_callAlert($this->_sSystem, 'replyRemoved', $iCmtPrntId, $iPerformerId, $aAlertParamsReply);
                 
                 /**
                  * @hooks
@@ -1628,7 +1628,7 @@ class BxDolCmts extends BxDolFactory implements iBxDolReplaceable, iBxDolContent
                  * except 'comment id' is provided in $object_id
                  * @hook @ref hook-reply-deleted
                  */
-                bx_alert('reply', 'deleted', $iCmtId, $iPerformerId, $aAlertParamsReply);
+                $this->_callAlert('reply', 'deleted', $iCmtId, $iPerformerId, $aAlertParamsReply);
             }
         }
 
@@ -1771,7 +1771,7 @@ class BxDolCmts extends BxDolFactory implements iBxDolReplaceable, iBxDolContent
          *      - `cf` - [int] comment's audience filter value
          * @hook @ref hook-bx_dol_comment-commentPost
          */
-        bx_alert($this->_sSystem, 'commentPost', $iObjId, $iPerformerId, $aAlertParams);
+        $this->_callAlert($this->_sSystem, 'commentPost', $iObjId, $iPerformerId, $aAlertParams);
         
         /**
          * @hooks
@@ -1780,7 +1780,7 @@ class BxDolCmts extends BxDolFactory implements iBxDolReplaceable, iBxDolContent
          * except 'comment id' is provided in $object_id
          * @hook @ref hook-comment-added
          */
-        bx_alert('comment', 'added', $iCmtId, $iPerformerId, $aAlertParams);
+        $this->_callAlert('comment', 'added', $iCmtId, $iPerformerId, $aAlertParams);
 
         $aAuditParams = $this->_prepareAuditParams($iCmtId, array('comment_author_id' => $aCmt['cmt_author_id'], 'comment_text' => $aCmt['cmt_text']));
         bx_audit($iObjId, $this->_aSystem['module'], '_sys_audit_action_add_comment', $aAuditParams);
@@ -1813,7 +1813,7 @@ class BxDolCmts extends BxDolFactory implements iBxDolReplaceable, iBxDolContent
                  *      - `privacy_view` - [int] or [string] privacy for view comment action, @see BxDolPrivacy
                  * @hook @ref hook-bx_dol_comment-replyPost
                  */
-                bx_alert($this->_sSystem, 'replyPost', $iCmtPrntId, $iPerformerId, $aAlertParamsReply);
+                $this->_callAlert($this->_sSystem, 'replyPost', $iCmtPrntId, $iPerformerId, $aAlertParamsReply);
                 
                 /**
                  * @hooks
@@ -1822,7 +1822,7 @@ class BxDolCmts extends BxDolFactory implements iBxDolReplaceable, iBxDolContent
                  * except 'comment id' is provided in $object_id
                  * @hook @ref hook-comment-replied
                  */
-                bx_alert('comment', 'replied', $iCmtId, $iPerformerId, $aAlertParamsReply);
+                $this->_callAlert('comment', 'replied', $iCmtId, $iPerformerId, $aAlertParamsReply);
             }
         }
 
@@ -1885,7 +1885,7 @@ class BxDolCmts extends BxDolFactory implements iBxDolReplaceable, iBxDolContent
          *      - `cf` - [int] comment's audience filter value
          * @hook @ref hook-bx_dol_comment-commentUpdated
          */
-        bx_alert($this->_sSystem, 'commentUpdated', $iObjId, $iPerformerId, $aAlertParams);
+        $this->_callAlert($this->_sSystem, 'commentUpdated', $iObjId, $iPerformerId, $aAlertParams);
         
         /**
          * @hooks
@@ -1894,7 +1894,7 @@ class BxDolCmts extends BxDolFactory implements iBxDolReplaceable, iBxDolContent
          * except 'comment id' is provided in $object_id
          * @hook @ref hook-comment-edited
          */
-        bx_alert('comment', 'edited', $iCmtId, $iPerformerId, $aAlertParams);
+        $this->_callAlert('comment', 'edited', $iCmtId, $iPerformerId, $aAlertParams);
 
         $aAuditParams = $this->_prepareAuditParams($iCmtId, ['comment_author_id' => $aCmt['cmt_author_id'], 'comment_text' => $aCmt['cmt_text']]);
         bx_audit($iObjId, $this->_aSystem['module'], '_sys_audit_action_edit_comment', $aAuditParams);
@@ -2200,6 +2200,11 @@ class BxDolCmts extends BxDolFactory implements iBxDolReplaceable, iBxDolContent
         $aDp['show_empty'] = isset($aDp['show_empty']) ? (bool)$aDp['show_empty'] : false;
     }
 
+    protected function _callAlert($sUnit, $sAction, $iObjectId, $iSender = false, $aExtras = [])
+    {
+        return bx_alert($sUnit, $sAction, $iObjectId, $iSender, $aExtras);
+    }
+
     protected function _prepareAlertParams($aCmt)
     {
         $iObjId = (int)$this->getId();
@@ -2671,7 +2676,7 @@ class BxDolCmts extends BxDolFactory implements iBxDolReplaceable, iBxDolContent
          *      - `data_api` - [array] by ref, comment data prepared for sending in API response, can be overridden in hook processing
          * @hook @ref hook-system-decode_comment_data_api
          */
-        bx_alert('system', 'decode_comment_data_api', 0, 0, $aExtras);
+        $this->_callAlert('system', 'decode_comment_data_api', 0, 0, $aExtras);
         
         /**
          * @hooks
@@ -2679,7 +2684,7 @@ class BxDolCmts extends BxDolFactory implements iBxDolReplaceable, iBxDolContent
          * It's equivalent to @ref hook-system-decode_comment_data_api
          * @hook @ref hook-bx_dol_comment-decode_comment_data_api
          */
-        bx_alert($sModule, 'decode_comment_data_api', 0, 0, $aExtras);
+        $this->_callAlert($sModule, 'decode_comment_data_api', 0, 0, $aExtras);
 
         return $aDataApi;
     }

+ 9 - 0
modules/boonex/tasks/classes/BxTasksCmts.php

@@ -119,6 +119,15 @@ class BxTasksCmts extends BxTemplCmts
         return $aTmplVarsText;
     }
 
+    protected function _callAlert($sUnit, $sAction, $iObjectId, $iSender = false, $aExtras = [])
+    {
+        echo 'Here' . $iSender . ' - ' . $this->_iAuthorAuto;
+        if($iSender && $iSender == $this->_iAuthorAuto)
+            return;
+
+        return bx_alert($sUnit, $sAction, $iObjectId, $iSender, $aExtras);
+    }
+
     protected function _prepareAlertParams($aCmt)
     {
         $aResult = parent::_prepareAlertParams($aCmt);