Fix prevent originator link in activity stream

This commit is contained in:
buddh4 2020-01-23 18:20:39 +01:00
parent 07298ee1cc
commit e814bf2208
2 changed files with 31 additions and 4 deletions

View File

@ -14,7 +14,6 @@ use humhub\modules\space\models\Space;
use humhub\modules\space\widgets\Image as SpaceImage;
use humhub\modules\user\widgets\Image as UserImage;
use Yii;
use yii\helpers\Html;
use yii\helpers\Url;
use yii\helpers\FileHelper;
use yii\web\UploadedFile;
@ -230,11 +229,31 @@ class ProfileImage
}
$cfg['width'] = $width;
$widgetOptions = ['width' => $width];
// TODO: improve option handling...
if(isset($cfg['link'])) {
$widgetOptions['link'] = $cfg['link'];
unset($cfg['link']);
}
if(isset($cfg['showTooltip'])) {
$widgetOptions['showTooltip'] = $cfg['showTooltip'];
unset($cfg['showTooltip']);
}
if(isset($cfg['tooltipText'])) {
$widgetOptions['tooltipText'] = $cfg['tooltipText'];
unset($cfg['tooltipText']);
}
if($container instanceof Space) {
return SpaceImage::widget(['width' => $width, 'space' => $container, 'htmlOptions' => $cfg]);
$widgetOptions['space'] = $container;
$widgetOptions['htmlOptions'] = $cfg;
return SpaceImage::widget($widgetOptions);
}
$htmlOptions = [];
if(isset($cfg['htmlOptions'])) {
@ -242,6 +261,10 @@ class ProfileImage
unset($cfg['htmlOptions']);
}
return UserImage::widget(['width' => $width, 'user' => $container, 'imageOptions' => $cfg, 'htmlOptions' => $htmlOptions]);
$widgetOptions['user'] = $container;
$widgetOptions['imageOptions'] = $cfg;
$widgetOptions['htmlOptions'] = $htmlOptions;
return UserImage::widget($widgetOptions);
}
}

View File

@ -6,6 +6,7 @@
* @license https://www.humhub.com/licences
*/
use humhub\components\ActiveRecord;
use humhub\modules\content\components\ContentContainerController;
use humhub\modules\space\models\Space;
use humhub\modules\space\widgets\Image;
@ -13,6 +14,9 @@ use humhub\widgets\TimeAgo;
use yii\helpers\Url;
/* @var $originator \humhub\modules\user\models\User */
/* @var $clickable boolean */
/* @var $record ActiveRecord */
?>
<?php if ($clickable) : ?>
@ -22,7 +26,7 @@ use yii\helpers\Url;
<div class="media">
<?php if ($originator !== null) : ?>
<!-- Show user image -->
<?= $originator->getProfileImage()->render(32, ['class' => 'media-object', 'htmlOptions' => ['class' => 'pull-left']]) ?>
<?= $originator->getProfileImage()->render(32, ['class' => 'media-object', 'link' => false, 'htmlOptions' => ['class' => 'pull-left']]) ?>
<?php endif; ?>
<!-- Show space image, if you are outside from a space -->