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