From f0204432d4e969b3da99d36d3e09f4a9e09bd8c5 Mon Sep 17 00:00:00 2001 From: Rasmus Lindroth Date: Fri, 30 Dec 2022 15:56:37 +0100 Subject: [PATCH] use later version of go-mastodon --- api/feed.go | 4 ++-- api/status.go | 6 +++--- go.mod | 2 +- go.sum | 4 ++-- ui/input.go | 6 +++--- ui/item_status.go | 14 +++++++------- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/api/feed.go b/api/feed.go index 1137f78..79f8eca 100644 --- a/api/feed.go +++ b/api/feed.go @@ -168,10 +168,10 @@ func (ac *AccountClient) GetUsers(search string) ([]Item, error) { var users []*mastodon.Account var err error if strings.HasPrefix(search, "@") && len(strings.Split(search, "@")) == 3 { - users, err = ac.Client.AccountsSearch(context.Background(), search, 10, true) + users, err = ac.Client.AccountsSearchResolve(context.Background(), search, 10, true) } if len(users) == 0 || err != nil { - users, err = ac.Client.AccountsSearch(context.Background(), search, 10, false) + users, err = ac.Client.AccountsSearchResolve(context.Background(), search, 10, false) } if err != nil { return items, err diff --git a/api/status.go b/api/status.go index 925f5ca..1f33d25 100644 --- a/api/status.go +++ b/api/status.go @@ -40,7 +40,7 @@ func toggleHelper(s *mastodon.Status, comp bool, on, off statusToggleFunc) (*mas func (ac *AccountClient) BoostToggle(s *mastodon.Status) (*mastodon.Status, error) { return toggleHelper(s, - util.StatusOrReblog(s).Reblogged, + util.StatusOrReblog(s).Reblogged.(bool), ac.Boost, ac.Unboost, ) } @@ -55,7 +55,7 @@ func (ac *AccountClient) Unboost(s *mastodon.Status) (*mastodon.Status, error) { func (ac *AccountClient) FavoriteToogle(s *mastodon.Status) (*mastodon.Status, error) { return toggleHelper(s, - util.StatusOrReblog(s).Favourited, + util.StatusOrReblog(s).Favourited.(bool), ac.Favorite, ac.Unfavorite, ) } @@ -72,7 +72,7 @@ func (ac *AccountClient) Unfavorite(s *mastodon.Status) (*mastodon.Status, error func (ac *AccountClient) BookmarkToogle(s *mastodon.Status) (*mastodon.Status, error) { return toggleHelper(s, - util.StatusOrReblog(s).Bookmarked, + util.StatusOrReblog(s).Bookmarked.(bool), ac.Bookmark, ac.Unbookmark, ) } diff --git a/go.mod b/go.mod index a4b5568..4508baf 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/RasmusLindroth/tut go 1.18 require ( - github.com/RasmusLindroth/go-mastodon v0.0.18 + github.com/RasmusLindroth/go-mastodon v0.0.19 github.com/adrg/xdg v0.4.0 github.com/atotto/clipboard v0.1.4 github.com/gdamore/tcell/v2 v2.5.3 diff --git a/go.sum b/go.sum index 14f11f3..a0e3bf6 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,5 @@ -github.com/RasmusLindroth/go-mastodon v0.0.18 h1:E39YbpjNES4ZbVzEHWyOeewgXq/k2yHt7JCiVCxqXbY= -github.com/RasmusLindroth/go-mastodon v0.0.18/go.mod h1:Lr6n8V1U2b+9P89YZKsICkNc+oNeJXkygY7raei9SXE= +github.com/RasmusLindroth/go-mastodon v0.0.19 h1:oQMLXoeaMD9uCMBMCblffFRyoohDmFDHmCPyZaIsWFM= +github.com/RasmusLindroth/go-mastodon v0.0.19/go.mod h1:Lr6n8V1U2b+9P89YZKsICkNc+oNeJXkygY7raei9SXE= github.com/adrg/xdg v0.4.0 h1:RzRqFcjH4nE5C6oTAxhBtoE2IRyjBSa62SCbyPidvls= github.com/adrg/xdg v0.4.0/go.mod h1:N6ag73EX4wyxeaoeHctc1mas01KZgsj5tYiAIwqJE/E= github.com/atotto/clipboard v0.1.4 h1:EH0zSVneZPSuFR11BlR9YppQTVDbh5+16AmcJi4g1z4= diff --git a/ui/input.go b/ui/input.go index 9698b96..fa377a8 100644 --- a/ui/input.go +++ b/ui/input.go @@ -381,9 +381,9 @@ func (tv *TutView) InputStatus(event *tcell.EventKey, item api.Item, status *mas hasSpoiler := sr.Sensitive isMine := sr.Account.ID == tv.tut.Client.Me.ID - boosted := sr.Reblogged - favorited := sr.Favourited - bookmarked := sr.Bookmarked + boosted := sr.Reblogged.(bool) + favorited := sr.Favourited.(bool) + bookmarked := sr.Bookmarked.(bool) if tv.tut.Config.Input.StatusAvatar.Match(event.Key(), event.Rune()) { if nAcc != nil { diff --git a/ui/item_status.go b/ui/item_status.go index 411cdf2..147f467 100644 --- a/ui/item_status.go +++ b/ui/item_status.go @@ -124,7 +124,7 @@ func drawStatus(tv *TutView, item api.Item, status *mastodon.Status, main *tview toot.AccountDisplayName = tview.Escape(status.Account.DisplayName) toot.Account = tview.Escape(status.Account.Acct) - toot.Bookmarked = status.Bookmarked + toot.Bookmarked = status.Bookmarked.(bool) toot.Visibility = status.Visibility toot.Spoiler = status.Sensitive toot.Edited = status.CreatedAt.Before(status.EditedAt) @@ -198,14 +198,14 @@ func drawStatus(tv *TutView, item api.Item, status *mastodon.Status, main *tview } var info []Control - if status.Favourited && !isHistory { + if status.Favourited.(bool) && !isHistory { info = append(info, NewControl(tv.tut.Config, tv.tut.Config.Input.StatusFavorite, false)) - } else if !status.Favourited && !isHistory { + } else if !status.Favourited.(bool) && !isHistory { info = append(info, NewControl(tv.tut.Config, tv.tut.Config.Input.StatusFavorite, true)) } - if status.Reblogged && !isHistory { + if status.Reblogged.(bool) && !isHistory { info = append(info, NewControl(tv.tut.Config, tv.tut.Config.Input.StatusBoost, false)) - } else if !status.Reblogged && !isHistory { + } else if !status.Reblogged.(bool) && !isHistory { info = append(info, NewControl(tv.tut.Config, tv.tut.Config.Input.StatusBoost, true)) } if !isHistory { @@ -229,9 +229,9 @@ func drawStatus(tv *TutView, item api.Item, status *mastodon.Status, main *tview info = append(info, NewControl(tv.tut.Config, tv.tut.Config.Input.StatusDelete, true)) } - if !status.Bookmarked && !isHistory { + if !status.Bookmarked.(bool) && !isHistory { info = append(info, NewControl(tv.tut.Config, tv.tut.Config.Input.StatusBookmark, true)) - } else if status.Bookmarked && !isHistory { + } else if status.Bookmarked.(bool) && !isHistory { info = append(info, NewControl(tv.tut.Config, tv.tut.Config.Input.StatusBookmark, false)) } if !isHistory {