Fixed: Empty space message broken for members without write privileges

This commit is contained in:
Lucas Bartholemy 2016-07-05 07:54:52 +02:00
parent b424240b98
commit b58639f717
2 changed files with 22 additions and 9 deletions

View File

@ -75,7 +75,15 @@ class SpaceController extends \humhub\modules\content\components\ContentContaine
*/
public function actionHome()
{
return $this->render('home', ['space' => $this->contentContainer]);
$space = $this->contentContainer;
$canCreatePosts = $space->permissionManager->can(new \humhub\modules\post\permissions\CreatePost());
$isMember = $space->isMember();
return $this->render('home', [
'space' => $space,
'canCreatePosts' => $canCreatePosts,
'isMember' => $isMember
]);
}
/**

View File

@ -1,14 +1,19 @@
<?php echo \humhub\modules\post\widgets\Form::widget(['contentContainer' => $space]); ?>
<?php
echo \humhub\modules\content\widgets\Stream::widget(array(
$emptyMessage = '';
if ($canCreatePosts) {
$emptyMessage = Yii::t('SpaceModule.views_space_index', '<b>This space is still empty!</b><br>Start by posting something here...');
} elseif ($isMember) {
$emptyMessage = Yii::t('SpaceModule.views_space_index', '<b>This space is still empty!</b>');
} else {
$emptyMessage = Yii::t('SpaceModule.views_space_index', '<b>You are not member of this space and there is no public content, yet!</b>');
}
echo \humhub\modules\content\widgets\Stream::widget([
'contentContainer' => $space,
'streamAction' => '/space/space/stream',
'messageStreamEmpty' => ($space->permissionManager->can(new \humhub\modules\post\permissions\CreatePost())) ?
Yii::t('SpaceModule.views_space_index', '<b>This space is still empty!</b><br>Start by posting something here...') :
Yii::t('SpaceModule.views_space_index', '<b>You are not member of this space and there is no public content, yet!</b>'),
'messageStreamEmptyCss' => ($space->permissionManager->can(new \humhub\modules\post\permissions\CreatePost())) ?
'placeholder-empty-stream' :
'',
));
'messageStreamEmpty' => $emptyMessage,
'messageStreamEmptyCss' => ($canCreatePosts) ? 'placeholder-empty-stream' : '',
]);
?>