mirror of
https://github.com/humhub/humhub.git
synced 2025-01-17 14:18:27 +01:00
Merge pull request #4613 from humhub/fix/4612
Fix #4612: Dashboard wall stream entry displays user name in sub title
This commit is contained in:
commit
af38862725
@ -2,11 +2,17 @@ HumHub Changelog
|
||||
================
|
||||
|
||||
|
||||
1.7.1 (Unreleased)
|
||||
------------------
|
||||
- Fix #4612: Dashboard wall stream entry displays user name in sub title in post style layout
|
||||
- Fix #4614: Profile Image crop broken
|
||||
|
||||
|
||||
1.7.0 (November 4, 2020)
|
||||
------------------------
|
||||
- Fix #4590: Page loader color contrast too low
|
||||
- Fix #4599: File preview not visible if initialized in background
|
||||
- Fix #4614: Profile Image crop broken
|
||||
|
||||
|
||||
1.7.0-beta.2 (October 26, 2020)
|
||||
-------------------------------
|
||||
|
@ -5,12 +5,14 @@ namespace humhub\modules\content\tests\codeception\unit\widgets;
|
||||
|
||||
|
||||
use humhub\modules\content\helpers\ContentContainerHelper;
|
||||
use humhub\modules\content\widgets\DeleteLink;
|
||||
use humhub\modules\content\widgets\stream\StreamEntryOptions;
|
||||
use humhub\modules\content\widgets\stream\StreamEntryWidget;
|
||||
use humhub\modules\content\widgets\stream\WallStreamEntryOptions;
|
||||
use humhub\modules\content\widgets\WallEntryControls;
|
||||
use humhub\modules\post\models\Post;
|
||||
use humhub\modules\post\widgets\WallEntry;
|
||||
use humhub\modules\ui\menu\WidgetMenuEntry;
|
||||
use tests\codeception\_support\HumHubDbTestCase;
|
||||
|
||||
class WallEntryOptionsTest extends HumHubDbTestCase
|
||||
@ -25,6 +27,7 @@ class WallEntryOptionsTest extends HumHubDbTestCase
|
||||
$this->assertEquals(WallEntry::class, $wallStreamEntryOptions->getStreamEntryWidgetClass());
|
||||
}
|
||||
|
||||
|
||||
public function testDisableControlsEdit()
|
||||
{
|
||||
$this->testDisableControlsItem('Edit',
|
||||
@ -135,6 +138,33 @@ class WallEntryOptionsTest extends HumHubDbTestCase
|
||||
]));
|
||||
}
|
||||
|
||||
public function testWallEntryIsUsingOwnOptionInstance()
|
||||
{
|
||||
$this->becomeUser('admin');
|
||||
|
||||
$model = Post::findOne(['id' => 1]);
|
||||
|
||||
$renderOptions = new WallStreamEntryOptions();
|
||||
$renderOptions->viewContext(StreamEntryOptions::VIEW_CONTEXT_MODAL);
|
||||
$renderOptions->disableControlsEntryEdit();
|
||||
|
||||
$wallEntryA = new WallEntry(['model' => $model, 'renderOptions' => $renderOptions]);
|
||||
$wallEntryB = new WallEntry(['model' => $model, 'renderOptions' => $renderOptions]);
|
||||
|
||||
$wallEntryA->renderOptions->disableControlsEntryDelete();
|
||||
|
||||
static::assertEquals(StreamEntryOptions::VIEW_CONTEXT_MODAL, $wallEntryA->renderOptions->getViewContext());
|
||||
static::assertEquals(StreamEntryOptions::VIEW_CONTEXT_MODAL, $wallEntryB->renderOptions->getViewContext());
|
||||
|
||||
static::assertTrue($wallEntryA->renderOptions->isContextMenuEntryDisabled(new WidgetMenuEntry(['widgetClass' => DeleteLink::class])));
|
||||
static::assertFalse($wallEntryB->renderOptions->isContextMenuEntryDisabled(new WidgetMenuEntry(['widgetClass' => DeleteLink::class])));
|
||||
|
||||
$wallEntryB->renderOptions->viewContext(StreamEntryOptions::VIEW_CONTEXT_DASHBOARD);
|
||||
|
||||
static::assertEquals(StreamEntryOptions::VIEW_CONTEXT_MODAL, $wallEntryA->renderOptions->getViewContext());
|
||||
static::assertEquals(StreamEntryOptions::VIEW_CONTEXT_DASHBOARD, $wallEntryB->renderOptions->getViewContext());
|
||||
}
|
||||
|
||||
private function assertWallEntryControlsContains($searchStr, $renderOptions)
|
||||
{
|
||||
$this->becomeUser('admin');
|
||||
|
@ -62,6 +62,9 @@ abstract class StreamEntryWidget extends JsWidget
|
||||
if(!$this->renderOptions || !is_a($this->renderOptions, $this->renderOptionClass, true)) {
|
||||
$optionClass = $this->renderOptionClass;
|
||||
$this->renderOptions = new $optionClass($this->renderOptions);
|
||||
} else {
|
||||
// Make sure we are using an own instance of renderOptions
|
||||
$this->renderOptions = clone $this->renderOptions;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user