3 namespace wcf\system\box
;
5 use wcf\data\comment\ViewableCommentList
;
6 use wcf\data\user\profile\comment\ViewableUserProfileComment
;
7 use wcf\data\user\User
;
8 use wcf\data\user\UserProfile
;
9 use wcf\system\user\UserProfileHandler
;
13 * Box controller implementation for a list of comments on user profiles.
15 * @author Alexander Ebert
16 * @copyright 2001-2019 WoltLab GmbH
17 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
18 * @package WoltLabSuite\Core\System\Box
20 class ProfileCommentListBoxController
extends AbstractCommentListBoxController
25 protected $objectTypeName = 'com.woltlab.wcf.user.profileComment';
30 protected function applyObjectTypeFilters(ViewableCommentList
$commentList)
32 $commentList->decoratorClassName
= ViewableUserProfileComment
::class;
34 if (WCF
::getSession()->getPermission('user.profile.canViewUserProfile')) {
35 $optionID = User
::getUserOptionID('canViewProfile');
36 $commentList->sqlJoins
.= '
37 INNER JOIN wcf' . WCF_N
. '_user_option_value user_option_value
38 ON user_option_value.userID = comment.objectID';
40 if (WCF
::getUser()->userID
) {
41 $followers = UserProfileHandler
::getInstance()->getFollowers();
42 if (empty($followers)) {
43 $commentList->getConditionBuilder()->add("(
44 user_option_value.userOption{$optionID} IN (?)
45 OR user_option_value.userID = ?
48 UserProfile
::ACCESS_EVERYONE
,
49 UserProfile
::ACCESS_REGISTERED
,
51 WCF
::getUser()->userID
,
54 $commentList->getConditionBuilder()->add("(
55 user_option_value.userOption{$optionID} IN (?)
57 user_option_value.userOption{$optionID} = ?
58 AND comment.objectID IN (?)
60 OR user_option_value.userID = ?
63 UserProfile
::ACCESS_EVERYONE
,
64 UserProfile
::ACCESS_REGISTERED
,
66 UserProfile
::ACCESS_FOLLOWING
,
68 WCF
::getUser()->userID
,
72 $commentList->getConditionBuilder()->add(
73 "user_option_value.userOption{$optionID} = ?",
74 [UserProfile
::ACCESS_EVERYONE
]
78 $commentList->getConditionBuilder()->add('0 = 1');