Skip to content

Commit

Permalink
minor change
Browse files Browse the repository at this point in the history
  • Loading branch information
cp-contact-c committed Nov 29, 2024
1 parent 0768586 commit 06718d8
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions post/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,8 @@ func (repository *Repository) Show(c *gin.Context) {
c.AbortWithStatus(http.StatusInternalServerError)
return
}
post.RecommendedPosts = repository.FilterPostsByTags(recommendedPosts, repository.ExtractTagNames(post.Tags))
post.RecommendedPosts = repository.SetPostImageInRecommendedPosts(post.RecommendedPosts)
filteredRecommendedPosts := repository.FilterPostsByTags(recommendedPosts, repository.ExtractTagNames(post.Tags))
post.RecommendedPosts = repository.SetPostImageInRecommendedPosts(filteredRecommendedPosts)
}

new_posts := repository.PreparePosts([]Post{post})
Expand Down Expand Up @@ -265,8 +265,7 @@ func (repository *Repository) SetPostImageInRecommendedPosts(recommendedPosts []
newPostIds := strings.Join(postIds, ", ")

images := []Image{}
postImageQuery := fmt.Sprintf(`SELECT f.id, frm.related_id as related_id, f.name, f.alternative_text, f.caption, f.width, f.height, f.formats as format, f.hash, f.ext, f.mime,
f.size, f.url, f.preview_url, f.provider, f.provider_metadata, f.folder_path, f.created_at, f.updated_at
postImageQuery := fmt.Sprintf(`SELECT f.id, frm.related_id as related_id, f.alternative_text, f.url
FROM files f
JOIN files_related_morphs frm ON frm.related_id IN (%s) AND frm.related_type = 'api::post.post' AND frm.file_id = f.id`, newPostIds)

Expand Down

0 comments on commit 06718d8

Please sign in to comment.