mirror of
https://github.com/mrusme/neonmodem.git
synced 2024-09-22 04:35:55 -04:00
Lemmy ListPosts query optimization
This commit is contained in:
parent
30fb8e80e9
commit
7fb12fe84f
@ -211,22 +211,23 @@ func (sys *System) ListPosts(forumID string) ([]post.Post, error) {
|
||||
showAll = true
|
||||
}
|
||||
|
||||
resp := &types.GetPostsResponse{}
|
||||
var getPosts types.GetPosts
|
||||
if showAll {
|
||||
resp, err = sys.client.Posts(context.Background(), types.GetPosts{
|
||||
getPosts = types.GetPosts{
|
||||
Type: types.NewOptional(types.ListingTypeSubscribed),
|
||||
Sort: types.NewOptional(types.SortTypeNew),
|
||||
Limit: types.NewOptional(int64(50)),
|
||||
})
|
||||
}
|
||||
} else {
|
||||
resp, err = sys.client.Posts(context.Background(), types.GetPosts{
|
||||
getPosts = types.GetPosts{
|
||||
Type: types.NewOptional(types.ListingTypeSubscribed),
|
||||
Sort: types.NewOptional(types.SortTypeNew),
|
||||
Limit: types.NewOptional(int64(50)),
|
||||
CommunityID: types.NewOptional(communityID),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
resp, err := sys.client.Posts(context.Background(), getPosts)
|
||||
if err != nil {
|
||||
return []post.Post{}, err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user