caret

[ACTIVE] a command line tool for browsing Lobsters in your terminal
git clone git://git.figbert.com/caret.git
Log | Files | Refs | README | LICENSE

commit 8626bf108a0c0c577abdf93d507f6045572d3acd
parent 6ec6d3cadb16e1e395fd7a61fc62b8502b0e505d
Author: FIGBERT <figbert@figbert.com>
Date:   Wed, 20 Mar 2024 12:29:45 -0700

Update schema

Diffstat:
Mapi/schema.go | 5+++--
Mcomments/comments.go | 2+-
Mcomments/header.go | 2+-
Mitem.go | 2+-
4 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/api/schema.go b/api/schema.go @@ -26,7 +26,7 @@ type Comment struct { CommentPlain string `json:"comment_plain"` URL string `json:"url"` Depth int `json:"depth"` - User User `json:"commenting_user"` + User string `json:"commenting_user"` } type Post struct { @@ -41,7 +41,8 @@ type Post struct { Paragraph string `json:"description"` DescriptionPlain string `json:"description_plain"` CommentsURL string `json:"comments_url"` - User User `json:"submitter_user"` + User string `json:"submitter_user"` + UserIsAuthor bool `json:"user_is_author"` Tags []string `json:"tags"` Comments []Comment `json:"comments"` } diff --git a/comments/comments.go b/comments/comments.go @@ -36,7 +36,7 @@ func Load(post api.Post) tea.Cmd { headline := fmt.Sprintf( " %s %s", - ui.Bold().Render(comment.User.Username), + ui.Bold().Render(comment.User), ui.Gray().Render(humanize.Time( utils.TimeFromAPI(comment.CreatedAt), )), diff --git a/comments/header.go b/comments/header.go @@ -33,7 +33,7 @@ func header(post *api.Post) string { posted := utils.TimeFromAPI(post.CreatedAt) - user := fmt.Sprintf("by %s %s", ui.LobstersRed().Render(post.User.Username), ui.Gray().Render(humanize.Time(posted))) + user := fmt.Sprintf("by %s %s", ui.LobstersRed().Render(post.User), ui.Gray().Render(humanize.Time(posted))) id := fmt.Sprintf("ID %s", gloss.NewStyle().Foreground(gloss.Color("2")).Render(post.ShortID)) cmnts := fmt.Sprintf("%s comments", gloss.NewStyle().Foreground(gloss.Color("5")).Render(fmt.Sprintf("%d", post.CommentCount))) karma := fmt.Sprintf("%s karma", ui.Orange().Render(fmt.Sprintf("%d", post.Score))) diff --git a/item.go b/item.go @@ -36,7 +36,7 @@ func (itm item) Description() string { intro := ui.Gray().Render( fmt.Sprintf( "%d upvotes via %s | %s | ", - itm.post.Score, itm.post.User.Username, humanize.Time(created), + itm.post.Score, itm.post.User, humanize.Time(created), ), )