mirror of
https://github.com/mrusme/neonmodem.git
synced 2024-09-29 04:45: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
|
showAll = true
|
||||||
}
|
}
|
||||||
|
|
||||||
resp := &types.GetPostsResponse{}
|
var getPosts types.GetPosts
|
||||||
if showAll {
|
if showAll {
|
||||||
resp, err = sys.client.Posts(context.Background(), types.GetPosts{
|
getPosts = types.GetPosts{
|
||||||
Type: types.NewOptional(types.ListingTypeSubscribed),
|
Type: types.NewOptional(types.ListingTypeSubscribed),
|
||||||
Sort: types.NewOptional(types.SortTypeNew),
|
Sort: types.NewOptional(types.SortTypeNew),
|
||||||
Limit: types.NewOptional(int64(50)),
|
Limit: types.NewOptional(int64(50)),
|
||||||
})
|
}
|
||||||
} else {
|
} else {
|
||||||
resp, err = sys.client.Posts(context.Background(), types.GetPosts{
|
getPosts = types.GetPosts{
|
||||||
Type: types.NewOptional(types.ListingTypeSubscribed),
|
Type: types.NewOptional(types.ListingTypeSubscribed),
|
||||||
Sort: types.NewOptional(types.SortTypeNew),
|
Sort: types.NewOptional(types.SortTypeNew),
|
||||||
Limit: types.NewOptional(int64(50)),
|
Limit: types.NewOptional(int64(50)),
|
||||||
CommunityID: types.NewOptional(communityID),
|
CommunityID: types.NewOptional(communityID),
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
resp, err := sys.client.Posts(context.Background(), getPosts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return []post.Post{}, err
|
return []post.Post{}, err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user