From e4ec2edf011dc29d3d6a5a34e634ce23cefe6add Mon Sep 17 00:00:00 2001 From: surajmn1 Date: Wed, 2 Nov 2022 16:46:29 +0530 Subject: [PATCH] append posts with status publish only --- api/graph/resolvers/category.go | 5 +++-- api/graph/resolvers/tag.go | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/api/graph/resolvers/category.go b/api/graph/resolvers/category.go index c4889b88..e22af6b8 100644 --- a/api/graph/resolvers/category.go +++ b/api/graph/resolvers/category.go @@ -86,8 +86,9 @@ func (r *categoryResolver) Posts(ctx context.Context, obj *models.Category) (*mo if err != nil { return nil, err } - - posts = append(posts, post) + if post.Status == "publish" { + posts = append(posts, post) + } } response := new(models.PostsPaging) response.Nodes = posts diff --git a/api/graph/resolvers/tag.go b/api/graph/resolvers/tag.go index 1e5a7914..7a03fda4 100644 --- a/api/graph/resolvers/tag.go +++ b/api/graph/resolvers/tag.go @@ -78,7 +78,9 @@ func (r *tagResolver) Posts(ctx context.Context, obj *models.Tag) (*models.Posts return nil, err } - posts = append(posts, post) + if post.Status == "publish" { + posts = append(posts, post) + } } response := new(models.PostsPaging) response.Nodes = posts