Skip to content

Commit 4523e6b

Browse files
authored
IBX-6260: Fixed preview voter taking language priority into consideration (#865)
1 parent 3df4f90 commit 4523e6b

File tree

1 file changed

+6
-19
lines changed

1 file changed

+6
-19
lines changed

src/lib/Siteaccess/AbstractSiteaccessPreviewVoter.php

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -32,38 +32,25 @@ public function __construct(
3232
*/
3333
public function vote(SiteaccessPreviewVoterContext $context): bool
3434
{
35-
$siteaccess = $context->getSiteaccess();
35+
$siteAccess = $context->getSiteaccess();
3636
$location = $context->getLocation();
3737
$languageCode = $context->getLanguageCode();
38-
$contentLanguages = $context->getVersionInfo()->languageCodes;
3938

40-
if (empty(array_intersect($this->getRootLocationIds($siteaccess), $location->path))) {
39+
if (empty(array_intersect($this->getRootLocationIds($siteAccess), $location->path))) {
4140
return false;
4241
}
4342

44-
if (!$this->validateRepositoryMatch($siteaccess)) {
43+
if (!$this->validateRepositoryMatch($siteAccess)) {
4544
return false;
4645
}
4746

48-
$siteaccessLanguages = $this->configResolver->getParameter(
47+
$siteAccessLanguages = $this->configResolver->getParameter(
4948
'languages',
5049
null,
51-
$siteaccess
50+
$siteAccess
5251
);
5352

54-
if (!in_array($languageCode, $siteaccessLanguages, true)) {
55-
return false;
56-
}
57-
58-
$primarySiteaccessLanguage = reset($siteaccessLanguages);
59-
if (
60-
$languageCode !== $primarySiteaccessLanguage
61-
&& in_array($primarySiteaccessLanguage, $contentLanguages)
62-
) {
63-
return false;
64-
}
65-
66-
return true;
53+
return in_array($languageCode, $siteAccessLanguages, true);
6754
}
6855

6956
protected function validateRepositoryMatch(string $siteaccess): bool

0 commit comments

Comments
 (0)