Skip to content

Commit

Permalink
[framework] fix blog category visibility calculation (#3503)
Browse files Browse the repository at this point in the history
  • Loading branch information
vitek-rostislav authored Oct 18, 2024
2 parents deadba4 + 7fd272b commit 3202798
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/Model/Blog/Article/BlogArticleResolverMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,18 @@

use DateTime;
use Overblog\GraphQLBundle\Resolver\ResolverMap;
use Shopsys\FrameworkBundle\Component\Domain\Domain;
use Shopsys\FrameworkBundle\Model\Blog\Category\BlogCategoryFacade;

class BlogArticleResolverMap extends ResolverMap
{
/**
* @param \Shopsys\FrameworkBundle\Model\Blog\Category\BlogCategoryFacade $blogCategoryFacade
* @param \Shopsys\FrameworkBundle\Component\Domain\Domain $domain
*/
public function __construct(
protected readonly BlogCategoryFacade $blogCategoryFacade,
protected readonly Domain $domain,
) {
}

Expand All @@ -26,7 +29,7 @@ protected function map(): array
return [
'BlogArticle' => [
'blogCategories' => function (array $blogArticleData) {
return $this->blogCategoryFacade->getByIds($blogArticleData['categories']);
return $this->blogCategoryFacade->getVisibleByIds($this->domain->getId(), $blogArticleData['categories']);
},
'publishDate' => static function (array $blogArticleData) {
return new DateTime($blogArticleData['publishDate']);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ BlogArticleDecorator:
description: "The blog article SEO H1 heading"
blogCategories:
type: "[BlogCategory!]!"
description: "The list of the blog article blog categories"
description: "The list of the blog article visible categories"
mainBlogCategoryUuid:
type: "Uuid!"
description: "The UUID of the main blog category of the blog article"
Expand Down

0 comments on commit 3202798

Please sign in to comment.