diff --git a/lib/action/opCommunityTopicPluginTopicActions.class.php b/lib/action/opCommunityTopicPluginTopicActions.class.php index 3f8c95e..be241eb 100644 --- a/lib/action/opCommunityTopicPluginTopicActions.class.php +++ b/lib/action/opCommunityTopicPluginTopicActions.class.php @@ -229,7 +229,7 @@ public function executeSearch($request) $this->pageUrl .= '?id='.$this->communityId; } - $q = $table->getSearchQuery($request->getParameter('id'), $request->getParameter('target'), $request->getParameter('keyword')); + $q = $table->getSearchQuery($request->getParameter('id'), $request->getParameter('target'), $request->getParameter('keyword'), $this->getUser()->getMemberId()); $this->pager = $table->getResultListPager($q, $request->getParameter('page')); $this->isResult = false; diff --git a/lib/model/doctrine/PluginCommunityTopicTable.class.php b/lib/model/doctrine/PluginCommunityTopicTable.class.php index f6944ea..19ef820 100644 --- a/lib/model/doctrine/PluginCommunityTopicTable.class.php +++ b/lib/model/doctrine/PluginCommunityTopicTable.class.php @@ -82,7 +82,7 @@ public function getRecentlyTopicListPager($memberId, $page = 1, $size = 50) return $pager; } - public function getSearchQuery($communityId = null, $target = null, $keyword = null) + public function getSearchQuery($communityId = null, $target = null, $keyword = null, $memberId = null) { $q = $this->createQuery(); @@ -105,7 +105,14 @@ public function getSearchQuery($communityId = null, $target = null, $keyword = n } } - $q->andWhereIn('community_id', opCommunityTopicToolkit::getPublicCommunityIdList()) + $targetCommunityIds = opCommunityTopicToolkit::getPublicCommunityIdList(); + if (!is_null($memberId)) + { + $targetCommunityIds = array_merge($targetCommunityIds, + Doctrine_Core::getTable('Community')->getIdsByMemberId($memberId)); + } + + $q->andWhereIn('community_id', $targetCommunityIds) ->orderBy('updated_at DESC'); return $q;