mirror of
https://github.com/humhub/humhub.git
synced 2025-01-16 21:58:17 +01:00
Fix visibility members counter for guests (#6037)
* Fix visibility members counter for guests * Display members count without link for guest
This commit is contained in:
parent
a37e6f78ea
commit
a37ef7c455
@ -11,6 +11,7 @@ HumHub Changelog
|
||||
- Enh #6001: Added new `ContentActiveFixture` and migrated `PostFixture` to it
|
||||
- Fix #6007: Fix number of space members
|
||||
- Fix #6012: View own invisible profile
|
||||
- Fix #6026: Fix visibility members counter for guests
|
||||
|
||||
1.13.0 (December 21, 2022)
|
||||
--------------------------
|
||||
|
@ -8,7 +8,9 @@
|
||||
namespace humhub\modules\space\widgets;
|
||||
|
||||
use humhub\components\Widget;
|
||||
use humhub\modules\space\models\Membership;
|
||||
use humhub\modules\space\models\Space;
|
||||
use Yii;
|
||||
|
||||
/**
|
||||
* SpaceDirectoryIcons shows footer icons for spaces cards
|
||||
@ -29,9 +31,17 @@ class SpaceDirectoryIcons extends Widget
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
if ($this->space->getAdvancedSettings()->hideMembers) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$membership = $this->space->getMembership();
|
||||
$membersCount = Membership::getSpaceMembersQuery($this->space)->active()->visible()->count();
|
||||
|
||||
return $this->render('spaceDirectoryIcons', [
|
||||
'space' => $this->space,
|
||||
'showMemberships' => !$this->space->getAdvancedSettings()->hideMembers
|
||||
'membersCount' => Yii::$app->formatter->asShortInteger($membersCount),
|
||||
'canViewMembers' => $membership && $membership->isPrivileged(),
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -5,18 +5,19 @@
|
||||
* @license https://www.humhub.com/licences
|
||||
*/
|
||||
|
||||
use humhub\modules\space\models\Membership;
|
||||
use humhub\modules\space\models\Space;
|
||||
use yii\helpers\Url;
|
||||
use yii\web\View;
|
||||
use humhub\widgets\Link;
|
||||
use yii\helpers\Html;
|
||||
|
||||
/* @var $this View */
|
||||
/* @var $space Space */
|
||||
/* @var $showMemberships bool */
|
||||
?>
|
||||
/* @var $membersCount int */
|
||||
/* @var $canViewMembers bool */
|
||||
|
||||
<?php if ($showMemberships): ?>
|
||||
<a href="#" class="fa fa-users" data-action-click="ui.modal.load"
|
||||
data-action-url="<?= Url::to(['/space/membership/members-list', 'container' => $space]) ?>">
|
||||
<span><?= Yii::$app->formatter->asShortInteger(Membership::getSpaceMembersQuery($space)->active()->visible()->count()) ?></span></a>
|
||||
<?php endif; ?>
|
||||
$text = ' <span>' . $membersCount . '</span>';
|
||||
$class = 'fa fa-users';
|
||||
?>
|
||||
<?php if ($canViewMembers) : ?>
|
||||
<?= Link::withAction($text, 'ui.modal.load', $space->createUrl('/space/membership/members-list'))->cssClass($class) ?>
|
||||
<?php else: ?>
|
||||
<?= Html::tag('span', $text, ['class' => $class]) ?>
|
||||
<?php endif; ?>
|
Loading…
x
Reference in New Issue
Block a user