Procházet zdrojové kódy

#4111 Mentions: link to content instead of link to search results in notification for comments

Alex Trofimov před 4 roky
rodič
revize
b84366e096
1 změnil soubory, kde provedl 10 přidání a 2 odebrání
  1. 10 2
      template/scripts/BxBaseServiceMetatags.php

+ 10 - 2
template/scripts/BxBaseServiceMetatags.php

@@ -93,8 +93,16 @@ class BxBaseServiceMetatags extends BxDol
             return [];
             return [];
 
 
         $sEntryUrl = '';
         $sEntryUrl = '';
-        if(isset($aEvent['content']['module']) && isset($aEvent['content']['content_id']) && BxDolRequest::serviceExists($aEvent['content']['module'], 'get_link'))
-            $sEntryUrl = str_replace(BX_DOL_URL_ROOT, '{bx_url_root}', bx_srv($aEvent['content']['module'], 'get_link', [$aEvent['content']['content_id']]));
+        if (isset($aEvent['content']['module']) && isset($aEvent['content']['content_id'])) {
+            if ('sys_cmts' == $aEvent['content']['module']) {
+                $oCmts = BxDolCmts::getObjectInstanceByUniqId($aEvent['content']['content_id']);
+                $aCmt = BxDolCmtsQuery::getCommentExtendedByUniqId($aEvent['content']['content_id']);
+                if ($oCmts && $aCmt)
+                    $sEntryUrl = $oCmts->getViewUrl($aCmt['cmt_id']);
+            } elseif (BxDolRequest::serviceExists($aEvent['content']['module'], 'get_link')) {
+                $sEntryUrl = str_replace(BX_DOL_URL_ROOT, '{bx_url_root}', bx_srv($aEvent['content']['module'], 'get_link', [$aEvent['content']['content_id']]));
+            }
+        }
 
 
         if(!$sEntryUrl)
         if(!$sEntryUrl)
             $sEntryUrl = '{bx_url_root}' . bx_append_url_params('searchKeyword.php', ['type' => 'mention', 'keyword' => $iProfile]);
             $sEntryUrl = '{bx_url_root}' . bx_append_url_params('searchKeyword.php', ['type' => 'mention', 'keyword' => $iProfile]);