Browse Source

use later version of go-mastodon

pull/240/head
Rasmus Lindroth 3 years ago
parent
commit
f0204432d4
  1. 4
      api/feed.go
  2. 6
      api/status.go
  3. 2
      go.mod
  4. 4
      go.sum
  5. 6
      ui/input.go
  6. 14
      ui/item_status.go

4
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

6
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,
)
}

2
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

4
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=

6
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 {

14
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 {

Loading…
Cancel
Save