From 7c9c3413cb6d3b5055667ea3559b1b373de689cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=83=9E=E3=83=AA=E3=82=A6=E3=82=B9?= Date: Sat, 31 Dec 2022 00:39:34 -0500 Subject: [PATCH] Tried debugging Lemmy comments issue https://github.com/Arsen6331/go-lemmy/issues/1 --- models/post/post.go | 3 ++- system/lemmy/lemmy.go | 12 ++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/models/post/post.go b/models/post/post.go index 09a3554..ffa07a0 100644 --- a/models/post/post.go +++ b/models/post/post.go @@ -41,7 +41,8 @@ func (post Post) Title() string { func (post Post) Description() string { return fmt.Sprintf( - "%s in %s on %s", + "[%s] %s in %s on %s", + post.ID, post.Author.Name, post.Forum.Name, post.CreatedAt.Format("Jan 2 2006"), diff --git a/system/lemmy/lemmy.go b/system/lemmy/lemmy.go index 7c9d342..32e79d4 100644 --- a/system/lemmy/lemmy.go +++ b/system/lemmy/lemmy.go @@ -83,8 +83,9 @@ func (sys *System) Load() error { func (sys *System) ListPosts(sysIdx int) ([]post.Post, error) { resp, err := sys.client.Posts(context.Background(), types.GetPosts{ - Type: types.NewOptional(types.ListingLocal), - Sort: types.NewOptional(types.New), + Type: types.NewOptional(types.ListingSubscribed), + Sort: types.NewOptional(types.New), + Limit: types.NewOptional(int64(50)), }) if err != nil { return []post.Post{}, err @@ -144,8 +145,15 @@ func (sys *System) LoadPost(p *post.Post) error { if err != nil { return err } + // cid, err := strconv.Atoi(p.Forum.ID) + // if err != nil { + // return err + // } resp, err := sys.client.Comments(context.Background(), types.GetComments{ + Type: types.NewOptional(types.ListingLocal), + Sort: types.NewOptional(types.CommentSortHot), + // CommunityID: types.NewOptional(cid), PostID: types.NewOptional(pid), }) if err != nil {