Skip to content

Commit

Permalink
IBX-7357: Adjusted Authors & Details tabs to modes specification
Browse files Browse the repository at this point in the history
  • Loading branch information
ViniTou committed Dec 14, 2023
1 parent 9c3fc93 commit b93c683
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 11 deletions.
9 changes: 1 addition & 8 deletions src/lib/Tab/LocationView/AuthorsTab.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,12 @@
namespace Ibexa\AdminUi\Tab\LocationView;

use Ibexa\AdminUi\Specification\UserExists;
use Ibexa\AdminUi\Specification\UserMode\IsUserModeEnabled;
use Ibexa\AdminUi\UserSetting\UserMode;
use Ibexa\Contracts\AdminUi\Tab\AbstractEventDispatchingTab;
use Ibexa\Contracts\AdminUi\Tab\ConditionalTabInterface;
use Ibexa\Contracts\AdminUi\Tab\OrderedTabInterface;
use Ibexa\Contracts\Core\Repository\UserService;
use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo;
use Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo;
use Ibexa\User\UserSetting\UserSettingService;
use JMS\TranslationBundle\Annotation\Desc;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
Expand All @@ -29,19 +26,15 @@ class AuthorsTab extends AbstractEventDispatchingTab implements OrderedTabInterf

private UserService $userService;

private UserSettingService $userSettingService;

public function __construct(
Environment $twig,
TranslatorInterface $translator,
UserService $userService,
UserSettingService $userSettingService,
EventDispatcherInterface $eventDispatcher
) {
parent::__construct($twig, $translator, $eventDispatcher);

$this->userService = $userService;
$this->userSettingService = $userSettingService;
}

public function getIdentifier(): string
Expand Down Expand Up @@ -92,7 +85,7 @@ public function getTemplateParameters(array $contextParameters = []): array

public function evaluate(array $parameters): bool
{
return IsUserModeEnabled::fromUserSettings($this->userSettingService)->isSatisfiedBy(UserMode::SMART);
return true;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/lib/Tab/LocationView/DetailsTab.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public function getName(): string

public function getOrder(): int
{
return 200;
return 750;
}

public function evaluate(array $parameters): bool
Expand Down
3 changes: 1 addition & 2 deletions tests/lib/Tab/LocationView/AuthorsTabVisibilityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,13 @@ protected function createTabForVisibilityInGivenUserModeTest(UserSettingService
$this->createMock(Environment::class),
$this->createMock(TranslatorInterface::class),
$this->createMock(UserService::class),
$userSettingService,
$this->createMock(EventDispatcherInterface::class)
);
}

public function dataProviderForTestTabVisibilityInGivenUserMode(): iterable
{
yield 'smart mode' => [UserMode::SMART, [], true];
yield 'expert mode' => [UserMode::EXPERT, [], false];
yield 'expert mode' => [UserMode::EXPERT, [], true];
}
}

0 comments on commit b93c683

Please sign in to comment.