mirror of
https://github.com/Oreolek/ifhub.club.git
synced 2024-06-26 03:30:48 +03:00
fix отображения комментов в закрытых блогах
This commit is contained in:
parent
7a5b54406e
commit
505012d2c2
|
@ -21,6 +21,12 @@
|
||||||
*/
|
*/
|
||||||
class ActionComments extends Action {
|
class ActionComments extends Action {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Текущий юзер
|
||||||
|
*
|
||||||
|
* @var unknown_type
|
||||||
|
*/
|
||||||
|
protected $oUserCurrent=null;
|
||||||
/**
|
/**
|
||||||
* Главное меню
|
* Главное меню
|
||||||
*
|
*
|
||||||
|
@ -29,6 +35,7 @@ class ActionComments extends Action {
|
||||||
protected $sMenuHeadItemSelect='blog';
|
protected $sMenuHeadItemSelect='blog';
|
||||||
|
|
||||||
public function Init() {
|
public function Init() {
|
||||||
|
$this->oUserCurrent=$this->User_GetUserCurrent();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function RegisterEvent() {
|
protected function RegisterEvent() {
|
||||||
|
@ -50,10 +57,16 @@ class ActionComments extends Action {
|
||||||
* Передан ли номер страницы
|
* Передан ли номер страницы
|
||||||
*/
|
*/
|
||||||
$iPage=$this->GetEventMatch(2) ? $this->GetEventMatch(2) : 1;
|
$iPage=$this->GetEventMatch(2) ? $this->GetEventMatch(2) : 1;
|
||||||
|
/**
|
||||||
|
* Исключаем из выборки идентификаторы закрытых блогов (target_parent_id)
|
||||||
|
*/
|
||||||
|
$aCloseBlogs = ($this->oUserCurrent)
|
||||||
|
? $this->Blog_GetInaccessibleBlogsByUser($this->oUserCurrent)
|
||||||
|
: $this->Blog_GetInaccessibleBlogsByUser();
|
||||||
/**
|
/**
|
||||||
* Получаем список комментов
|
* Получаем список комментов
|
||||||
*/
|
*/
|
||||||
$aResult=$this->Comment_GetCommentsAll('topic',$iPage,Config::Get('module.comment.per_page'));
|
$aResult=$this->Comment_GetCommentsAll('topic',$iPage,Config::Get('module.comment.per_page'),array(),$aCloseBlogs);
|
||||||
$aComments=$aResult['collection'];
|
$aComments=$aResult['collection'];
|
||||||
/**
|
/**
|
||||||
* Формируем постраничность
|
* Формируем постраничность
|
||||||
|
|
|
@ -68,13 +68,13 @@ class LsComment extends Module {
|
||||||
* @param unknown_type $iPerPage
|
* @param unknown_type $iPerPage
|
||||||
* @return unknown
|
* @return unknown
|
||||||
*/
|
*/
|
||||||
public function GetCommentsAll($sTargetType,$iPage,$iPerPage,$aExcludeTarget=array()) {
|
public function GetCommentsAll($sTargetType,$iPage,$iPerPage,$aExcludeTarget=array(),$aExcludeParentTarget=array()) {
|
||||||
$s=serialize($aExcludeTarget);
|
$s=serialize($aExcludeTarget).serialize($aExcludeParentTarget);
|
||||||
if (false === ($data = $this->Cache_Get("comment_all_{$sTargetType}_{$iPage}_{$iPerPage}_{$s}"))) {
|
if (false === ($data = $this->Cache_Get("comment_all_{$sTargetType}_{$iPage}_{$iPerPage}_{$s}"))) {
|
||||||
$data = array('collection'=>$this->oMapper->GetCommentsAll($sTargetType,$iCount,$iPage,$iPerPage,$aExcludeTarget),'count'=>$iCount);
|
$data = array('collection'=>$this->oMapper->GetCommentsAll($sTargetType,$iCount,$iPage,$iPerPage,$aExcludeTarget,$aExcludeParentTarget),'count'=>$iCount);
|
||||||
$this->Cache_Set($data, "comment_all_{$sTargetType}_{$iPage}_{$iPerPage}_{$s}", array("comment_new_{$sTargetType}","comment_update_status_{$sTargetType}"), 60*60*24*1);
|
$this->Cache_Set($data, "comment_all_{$sTargetType}_{$iPage}_{$iPerPage}_{$s}", array("comment_new_{$sTargetType}","comment_update_status_{$sTargetType}"), 60*60*24*1);
|
||||||
}
|
}
|
||||||
$data['collection']=$this->GetCommentsAdditionalData($data['collection']);
|
$data['collection']=$this->GetCommentsAdditionalData($data['collection'],array('target','favourite','user'=>array()));
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue