From 1bfe556ec368c2240d73fcddca74f6ec9049d2d9 Mon Sep 17 00:00:00 2001 From: Lucas Bartholemy Date: Fri, 21 Mar 2014 01:56:46 +0100 Subject: [PATCH] Fixed Space Profile Images & Removed GetUser() Calls --- .../HActiveRecordContentContainer.php | 4 +-- .../modules_core/activity/ActivityModule.php | 34 ------------------- protected/modules_core/activity/autostart.php | 1 - protected/modules_core/post/PostModule.php | 2 +- .../space/views/space/indexPublic.php | 11 ++---- protected/modules_core/wall/WallModule.php | 2 +- 6 files changed, 7 insertions(+), 47 deletions(-) diff --git a/protected/components/HActiveRecordContentContainer.php b/protected/components/HActiveRecordContentContainer.php index 11cbb3ea7e..581718c822 100644 --- a/protected/components/HActiveRecordContentContainer.php +++ b/protected/components/HActiveRecordContentContainer.php @@ -39,9 +39,9 @@ class HActiveRecordContentContainer extends HActiveRecord implements IContentCon public function getProfileImage() { if (get_class($this->getOwner()) == 'Space') { - return new ProfileImage($this->getOwner()->guid, 'default_space'); + return new ProfileImage($this->guid, 'default_space'); } - return new ProfileImage($this->getOwner()->guid); + return new ProfileImage($this->guid); } /** diff --git a/protected/modules_core/activity/ActivityModule.php b/protected/modules_core/activity/ActivityModule.php index f79941c3ff..4ef88dad60 100644 --- a/protected/modules_core/activity/ActivityModule.php +++ b/protected/modules_core/activity/ActivityModule.php @@ -66,39 +66,5 @@ class ActivityModule extends CWebModule { } } - /** - * On run of integrity check command, validate all activity - * - * @param type $event - */ - public static function onIntegrityCheck($event) { - - $integrityChecker = $event->sender; - - $integrityChecker->showTestHeadline("Validating Activity Module (" . Activity::model()->count() . " entries)"); - - foreach (Activity::model()->findAll() as $a) { - - // Check if underlying Model Exists - $className = $a->object_model; - if ($className != "") { - $obj = $className::model()->findByPk($a->object_id); - if ($obj === null) { - $integrityChecker->showFix("Deleting activity with id " . $a->id . " without existing underlying object!"); - if (!$integrityChecker->simulate) - $a->delete(); - continue; - } - } - if ($a->content != null) { - if ($a->content->getUser() == null) { - $integrityChecker->showFix("Deleting activity with id " . $a->id . " without existing user!"); - if (!$integrityChecker->simulate) - $a->delete(); - continue; - } - } - } - } } \ No newline at end of file diff --git a/protected/modules_core/activity/autostart.php b/protected/modules_core/activity/autostart.php index 3b733258e0..8f1b70f6c5 100644 --- a/protected/modules_core/activity/autostart.php +++ b/protected/modules_core/activity/autostart.php @@ -16,7 +16,6 @@ Yii::app()->moduleManager->register(array( array('class' => 'User', 'event' => 'onAfterDelete', 'callback' => array('ActivityModule', 'onUserDelete')), array('class' => 'Space', 'event' => 'onBeforeDelete', 'callback' => array('ActivityModule', 'onSpaceDelete')), array('class' => 'HActiveRecordContent', 'event' => 'onBeforeDelete', 'callback' => array('ActivityModule', 'onContentDelete')), - array('class' => 'IntegrityChecker', 'event' => 'onRun', 'callback' => array('ActivityModule', 'onIntegrityCheck')), ), 'contentModels' => array('Activity'), )); diff --git a/protected/modules_core/post/PostModule.php b/protected/modules_core/post/PostModule.php index f26f382bb5..60daa64fc0 100644 --- a/protected/modules_core/post/PostModule.php +++ b/protected/modules_core/post/PostModule.php @@ -74,7 +74,7 @@ class PostModule extends CWebModule { } // Check for valid Content Model - if ($post->content->getUser() === null) { + if ($post->content->user === null) { $integrityChecker->showFix("Deleting post with missing user - post id: " . $post->id); if (!$integrityChecker->simulate) $post->delete(); diff --git a/protected/modules_core/space/views/space/indexPublic.php b/protected/modules_core/space/views/space/indexPublic.php index f006843b15..2047ebedcd 100644 --- a/protected/modules_core/space/views/space/indexPublic.php +++ b/protected/modules_core/space/views/space/indexPublic.php @@ -15,7 +15,7 @@

name; ?>

getOwner()->displayName; ?> - description != "") { ?> + description != "") { ?>
description; ?> @@ -39,7 +39,7 @@ ?> - status == UserSpaceMembership::STATUS_INVITED) { @@ -65,12 +65,7 @@ - widget('application.modules_core.wall.widgets.WallStreamWidget', array( - 'type' => Wall::TYPE_SPACE, - 'guid' => $this->getSpace()->guid, - 'readonly' => ($this->getSpace()->status != Space::STATUS_ENABLED))); - ?> + widget('application.modules_core.wall.widgets.WallStreamWidget', array('contentContainer' => $space)); ?> diff --git a/protected/modules_core/wall/WallModule.php b/protected/modules_core/wall/WallModule.php index 46c4ad8672..3abe8c6612 100644 --- a/protected/modules_core/wall/WallModule.php +++ b/protected/modules_core/wall/WallModule.php @@ -46,7 +46,7 @@ class WallModule extends CWebModule { //TODO: Maybe not the best place for that $integrityChecker->showTestHeadline("Validating Content Objects (" . Content::model()->count() . " entries)"); foreach (Content::model()->findAll() as $content) { - if ($content->getUser() == null) { + if ($content->user == null) { $integrityChecker->showFix("Deleting content id " . $content->id . " of type " . $content->object_model . " without valid user!"); if (!$integrityChecker->simulate) $content->delete();