Fix: Empty stream message between friends

This commit is contained in:
Lucas Bartholemy 2017-12-01 00:10:20 +01:00
parent 9d9a81c4f2
commit 09e2329be4
4 changed files with 65 additions and 14 deletions

View File

@ -4,6 +4,8 @@ HumHub Change Log
-------------------------
- Fix: Added `ManageSpaces` and SystemAdmin check to `UserGroupAccessValidator`.
- Fix: Only include content with `stream_channel = default` into spacechooser update count.
- Fix: Empty stream message between friends
- Enh: Improve composer-asset-plugin config (cebe)
1.2.3 (October 23, 2017)
-------------------------

View File

@ -132,7 +132,7 @@ class StreamViewer extends Widget
$contentId = (int) Yii::$app->request->getQueryParam('contentId');
return $this->render('stream', [
return $this->render('@stream/widgets/views/stream', [
'streamUrl' => $this->getStreamUrl(),
'showFilters' => $this->showFilters,
'filters' => $this->filters,

View File

@ -1,17 +1,8 @@
<?php
use humhub\modules\post\widgets\Form;
use humhub\modules\user\widgets\StreamViewer;
?>
<?php echo \humhub\modules\post\widgets\Form::widget(['contentContainer' => $user]); ?>
<?php
echo \humhub\modules\stream\widgets\StreamViewer::widget(array(
'contentContainer' => $user,
'streamAction' => '//user/profile/stream',
'messageStreamEmpty' => ($user->permissionManager->can(new \humhub\modules\post\permissions\CreatePost())) ?
Yii::t('UserModule.views_profile_index', '<b>Your profile stream is still empty</b><br>Get started and post something...') :
Yii::t('UserModule.views_profile_index', '<b>This profile stream is still empty!</b>'),
'messageStreamEmptyCss' => ($user->permissionManager->can(new \humhub\modules\post\permissions\CreatePost())) ?
'placeholder-empty-stream' :
'',
));
?>
<?= Form::widget(['contentContainer' => $user]); ?>
<?= StreamViewer::widget(['contentContainer' => $user]); ?>

View File

@ -0,0 +1,58 @@
<?php
/**
* @link https://www.humhub.org/
* @copyright Copyright (c) 2017 HumHub GmbH & Co. KG
* @license https://www.humhub.com/licences
*/
namespace humhub\modules\user\widgets;
use Yii;
use humhub\modules\stream\widgets\StreamViewer as BaseStreamViewer;
use humhub\modules\user\models\User;
use humhub\modules\post\permissions\CreatePost;
/**
* StreamViewer shows a users profile stream
*
* @since 1.2.4
* @author Luke
*/
class StreamViewer extends BaseStreamViewer
{
/**
* @var string the path to Stream Action to use
*/
public $streamAction = '/user/profile/stream';
/**
* @inheritdoc
*/
public function init()
{
$createPostPermission = new CreatePost();
if (empty($this->messageStreamEmptyCss)) {
if ($this->contentContainer->permissionManager->can($createPostPermission)) {
$this->messageStreamEmptyCss = 'placeholder-empty-stream';
}
}
if (empty($this->messageStreamEmpty)) {
if ($this->contentContainer->permissionManager->can($createPostPermission)) {
if (Yii::$app->user->id === $this->contentContainer->id) {
$this->messageStreamEmpty = Yii::t('UserModule.views_profile_index', '<b>Your profile stream is still empty</b><br>Get started and post something...');
} else {
$this->messageStreamEmpty = Yii::t('UserModule.views_profile_index', '<b>This profile stream is still empty</b><br>Be the first and post something...');
}
} else {
$this->messageStreamEmpty = Yii::t('UserModule.views_profile_index', '<b>This profile stream is still empty!</b>');
}
}
parent::init();
}
}