Fix: Don't show wall entry contentContainer on own user profile posts

This commit is contained in:
Lucas Bartholemy 2017-03-25 12:59:44 +01:00
parent 250a6bf1e7
commit 1f932264cb

View File

@ -2,7 +2,7 @@
/**
* @link https://www.humhub.org/
* @copyright Copyright (c) 2016 HumHub GmbH & Co. KG
* @copyright Copyright (c) 2017 HumHub GmbH & Co. KG
* @license https://www.humhub.com/licences
*/
@ -11,7 +11,7 @@ namespace humhub\modules\content\widgets;
use Yii;
use humhub\components\Widget;
use humhub\modules\space\models\Space;
use humhub\modules\post\models\Post;
use humhub\modules\user\models\User;
use humhub\modules\content\components\ContentContainerController;
/**
@ -171,23 +171,21 @@ class WallEntry extends Widget
public function getWallEntryViewParams()
{
$showContentContainer = false;
$content = $this->contentObject->content;
$user = $content->createdBy;
$container = $content->container;
// && $this->contentObject->content->container instanceof Space
if (!Yii::$app->controller instanceof ContentContainerController) {
// In case of e.g. dashboard, show contentContainer of this content
if (!Yii::$app->controller instanceof ContentContainerController && !($container instanceof User && $container->id == $user->id)) {
$showContentContainer = true;
}
$user = $this->contentObject->content->createdBy;
$container = $this->contentObject->content->container;
$createdAt = $this->contentObject->content->created_at;
$createdAt = $content->created_at;
$updatedAt = null;
if ($createdAt !== $this->contentObject->content->updated_at && $this->contentObject->content->updated_at != '') {
$updatedAt = $this->contentObject->content->updated_at;
if ($createdAt !== $content->updated_at && $content->updated_at != '') {
$updatedAt = $content->updated_at;
}
return [
'content' => $this->run(),
'object' => $this->contentObject,