Prechádzať zdrojové kódy

Ticket #4774 - Notifications: Issues with new notifications counter.

AntonLV 2 rokov pred
rodič
commit
04dd8a844a

+ 6 - 1
modules/boonex/notifications/classes/BxNtfsConfig.php

@@ -254,7 +254,12 @@ class BxNtfsConfig extends BxBaseModNotificationsConfig
 
     public function getContentObjectId(&$aEvent)
     {
-        return !empty($aEvent['content']['object_id']) ? (int)$aEvent['content']['object_id'] : (int)$aEvent['object_id'];
+        $bContentObjectId = !empty($aEvent['content']['object_id']);
+
+        if(in_array($aEvent['action'], ['replyPost']) && !$bContentObjectId)
+            return false;
+
+        return $bContentObjectId ? (int)$aEvent['content']['object_id'] : (int)$aEvent['object_id'];
     }
 
     public function getProfileBasedModules() 

+ 7 - 1
modules/boonex/notifications/classes/BxNtfsModule.php

@@ -428,9 +428,15 @@ class BxNtfsModule extends BxBaseModNotificationsModule
             if($oPrivacyExt !== false && !$oPrivacyExt->check($aEvent['id'], $iViewerId))
                 continue;
 
+            $iContentObjectId = $this->_oConfig->getContentObjectId($aEvent);
+            if($iContentObjectId === false) {
+                $this->_oTemplate->getPost($aEvent, $aBrowseParams);
+                $iContentObjectId = $this->_oConfig->getContentObjectId($aEvent);
+            }
+
             $sSrvModule = $this->_oConfig->getContentModule($aEvent);
             $sSrvMethod = 'check_allowed_with_content_for_profile';
-            if($sSrvModule && BxDolRequest::serviceExists($sSrvModule, $sSrvMethod) && BxDolService::call($sSrvModule, $sSrvMethod, array('view', $this->_oConfig->getContentObjectId($aEvent), $iViewerId)) !== CHECK_ACTION_RESULT_ALLOWED)
+            if($sSrvModule && bx_is_srv($sSrvModule, $sSrvMethod) && bx_srv($sSrvModule, $sSrvMethod, ['view', $iContentObjectId, $iViewerId]) !== CHECK_ACTION_RESULT_ALLOWED)
                 continue;
 
             $bEventCanceled = false;

+ 1 - 1
modules/boonex/notifications/classes/BxNtfsResponse.php

@@ -204,7 +204,7 @@ class BxNtfsResponse extends BxBaseModNotificationsResponse
         $aComments = $oCmts->getCommentsBy(['type' => 'object_id', 'object_id' => $iObjectId]);
         foreach($aComments as $aComment) {
             $iCmtAuthorId = (int)$aComment['cmt_author_id'];
-            if(in_array($iCmtAuthorId, $aRecipients) || $iCmtAuthorId == $iOwnerId || $iCmtAuthorId == $iObjectOwnerId)
+            if(in_array($iCmtAuthorId, $aRecipients) || $iCmtAuthorId == $iOwnerId)
                 continue;
 
             $aResults[] = [

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

@@ -161,7 +161,7 @@ class BxNtfsTemplate extends BxBaseModNotificationsTemplate
 
             $sSrvModule = $this->_oConfig->getContentModule($aEvent);
             $sSrvMethod = 'check_allowed_with_content_for_profile';
-            if($sSrvModule && BxDolRequest::serviceExists($sSrvModule, $sSrvMethod) && BxDolService::call($sSrvModule, $sSrvMethod, array('view', $this->_oConfig->getContentObjectId($aEvent), $iViewerId)) !== CHECK_ACTION_RESULT_ALLOWED)
+            if($sSrvModule && bx_is_srv($sSrvModule, $sSrvMethod) && bx_srv($sSrvModule, $sSrvMethod, ['view', $this->_oConfig->getContentObjectId($aEvent), $iViewerId]) !== CHECK_ACTION_RESULT_ALLOWED)
                 return '';
         }
 
@@ -363,7 +363,7 @@ class BxNtfsTemplate extends BxBaseModNotificationsTemplate
             return false;
 
         $sMessage = is_array($aEvent['content_parsed']) && isset($aEvent['content_parsed']['push']) ? $aEvent['content_parsed']['push'] : $aEvent['content_parsed'];
-        $sMessage = preg_replace('/<\/?[a-zA-Z0-9=\'":;\(\)\s_-]+>/i', '"', $sMessage);
+        $sMessage = preg_replace('/<\/?[a-zA-Z0-9=\'":;\(\)\s_-]+>/i', ($sChar = getParam("bx_ntfs_option_tag_to_char_push")) !== false ? $sChar : '"', $sMessage);
         if($sMessage)
             $sMessage = BxTemplFunctions::getInstance()->getStringWithLimitedLength(html_entity_decode($sMessage), $this->_oConfig->getPushMaxLen());