mirror of
https://github.com/humhub/humhub.git
synced 2025-01-17 22:28:51 +01:00
Fixed Space Profile Images & Removed GetUser() Calls
This commit is contained in:
parent
58815dc5c6
commit
1bfe556ec3
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -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'),
|
||||
));
|
||||
|
@ -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();
|
||||
|
@ -15,7 +15,7 @@
|
||||
<h3 class="media-heading"><?php echo $space->name; ?></h3>
|
||||
<?php echo Yii::t('SpaceModule.base', 'created by'); ?> <a
|
||||
href="<?php echo Yii::app()->createUrl('//user/profile', array('uguid' => $space->getOwner()->guid)); ?>"><?php echo $space->getOwner()->displayName; ?></a>
|
||||
<?php if ($space->description != "") { ?>
|
||||
<?php if ($space->description != "") { ?>
|
||||
<hr>
|
||||
<?php echo $space->description; ?>
|
||||
<?php } ?>
|
||||
@ -39,7 +39,7 @@
|
||||
?>
|
||||
<a href="<?php echo $this->createUrl('//space/space/requestMembership', array('sguid' => $space->guid)); ?>"
|
||||
class="btn btn-primary"><?php echo Yii::t('SpaceModule.base', 'Become member'); ?></a>
|
||||
<?php
|
||||
<?php
|
||||
}
|
||||
}
|
||||
} elseif ($membership->status == UserSpaceMembership::STATUS_INVITED) {
|
||||
@ -65,12 +65,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
$this->widget('application.modules_core.wall.widgets.WallStreamWidget', array(
|
||||
'type' => Wall::TYPE_SPACE,
|
||||
'guid' => $this->getSpace()->guid,
|
||||
'readonly' => ($this->getSpace()->status != Space::STATUS_ENABLED)));
|
||||
?>
|
||||
<?php $this->widget('application.modules_core.wall.widgets.WallStreamWidget', array('contentContainer' => $space)); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user