From af615980705fc6be2aa2d046dad8557e1a39f60d Mon Sep 17 00:00:00 2001 From: Ezra Smith Date: Tue, 22 Aug 2023 11:17:16 -0400 Subject: [PATCH] Check correct variable to get post caption --- graphql/resolver/schema.resolvers.helpers.go | 2 +- publicapi/contract.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/graphql/resolver/schema.resolvers.helpers.go b/graphql/resolver/schema.resolvers.helpers.go index 771182b32..90711a927 100644 --- a/graphql/resolver/schema.resolvers.helpers.go +++ b/graphql/resolver/schema.resolvers.helpers.go @@ -716,7 +716,7 @@ func postsToConnection(ctx context.Context, posts []db.Post, contractID persist. cval, _ := p.Caption.Value() var caption *string - if caption != nil { + if cval != nil { caption = util.ToPointer(cval.(string)) } diff --git a/publicapi/contract.go b/publicapi/contract.go index 104de253e..6fd0fd04f 100644 --- a/publicapi/contract.go +++ b/publicapi/contract.go @@ -298,8 +298,8 @@ func (api ContractAPI) GetCommunityPostsByContractID(ctx context.Context, contra } results := make([]interface{}, len(posts)) - for i, owner := range posts { - results[i] = owner + for i, post := range posts { + results[i] = post } return results, nil @@ -314,7 +314,7 @@ func (api ContractAPI) GetCommunityPostsByContractID(ctx context.Context, contra if user, ok := i.(db.Post); ok { return user.CreatedAt, user.ID, nil } - return time.Time{}, "", fmt.Errorf("interface{} is not a token") + return time.Time{}, "", fmt.Errorf("interface{} is not a post") } paginator := timeIDPaginator{