Merge branch 'master' into develop

This commit is contained in:
Lucas Bartholemy 2021-01-07 14:23:17 +01:00
commit fc14f4101a
4 changed files with 22 additions and 8 deletions

View File

@ -12,6 +12,8 @@ HumHub Changelog
- Fix #4649: Success message rendered although password validation failed
- Fix #4717: Repsonsive layout alignment issue on small screens
- Fix #4715: Call to `Content::canArchive()` throws error on global content
- Fix #4744: Banner image orientation not being processed
- Fix #4743: Hide "Like" link when no permission "Can like"
1.7.1 (November 27, 2020)

View File

@ -8,6 +8,7 @@
namespace humhub\libs;
use humhub\modules\file\libs\ImageHelper;
use Imagine\Image\Box;
use Imagine\Image\ManipulatorInterface;
use yii\imagine\Image;
@ -74,6 +75,7 @@ class ProfileBannerImage extends ProfileImage
// Make sure original file is max. 800 width
$image = Image::getImagine()->open($file);
ImageHelper::fixJpegOrientation($image, $file);
if ($image->getSize()->getWidth() > 2000) {
$image->resize($image->getSize()->widen(2000));
}

View File

@ -92,10 +92,6 @@ class Events extends \yii\base\BaseObject
*/
public static function onWallEntryLinksInit($event)
{
if (!static::getModule()->isEnabled) {
return;
}
$event->sender->addWidget(widgets\LikeLink::class, ['object' => $event->sender->object], ['sortOrder' => 10]);
}

View File

@ -8,6 +8,9 @@ use yii\helpers\Html;
use humhub\modules\like\Module;
use humhub\modules\like\models\Like as LikeModel;
use humhub\modules\content\components\ContentActiveRecord;
use humhub\modules\content\components\ContentContainerActiveRecord;
use humhub\modules\like\permissions\CanLike;
/**
* This widget is used to show a like link inside the wall entry controls.
*
@ -24,15 +27,26 @@ class LikeLink extends \yii\base\Widget
*/
public $object;
/**
* @inheritdoc
*/
public function beforeRun()
{
if (!Yii::$app->getModule('like')->isEnabled ||
!isset($this->object->content->container) ||
!($this->object->content->container instanceof ContentContainerActiveRecord) ||
!$this->object->content->container->can(CanLike::class)) {
return false;
}
return parent::beforeRun();
}
/**
* Executes the widget.
*/
public function run()
{
if (Yii::$app->getModule('like')->isEnabled === false) {
return;
}
$currentUserLiked = false;
/** @var Module $module */
$module = Yii::$app->getModule('like');