Browse Source

Stop using old API for mention searches

This caused some errors on GoToSocial.
master
Ryan Fox 3 months ago
parent
commit
21d2927e50
Signed by: flewkey GPG Key ID: 94F56ADFD848851E
  1. 7
      src/Command.elm
  2. 6
      src/Mastodon/ApiUrl.elm
  3. 2
      src/Types.elm
  4. 4
      src/Update/Mastodon.elm

7
src/Command.elm

@ -254,7 +254,7 @@ searchAccounts client query limit resolve =
Just client ->
let
qs =
[ ( "q", query )
[ ( "q", "@"++query )
, ( "limit", toString limit )
, ( "resolve"
, if resolve then
@ -262,11 +262,12 @@ searchAccounts client query limit resolve =
else
"false"
)
, ( "exclude_unreviewed", "false" )
]
in
HttpBuilder.get ApiUrl.searchAccount
HttpBuilder.get ApiUrl.search
|> withClient client
|> withBodyDecoder (Decode.list accountDecoder)
|> withBodyDecoder (searchResultsDecoder)
|> withQueryParams qs
|> send (MastodonEvent << AutoSearch)

6
src/Mastodon/ApiUrl.elm

@ -31,7 +31,6 @@ module Mastodon.ApiUrl
, unblock
, uploadMedia
, streaming
, searchAccount
, search
)
@ -112,11 +111,6 @@ search =
api2Prefix ++ "/search"
searchAccount : String
searchAccount =
accounts ++ "search"
relationships : String
relationships =
accounts ++ "relationships"

2
src/Types.elm

@ -59,7 +59,7 @@ type MastodonMsg
| AccountUnblocked Account (MastodonResult Relationship)
| AccountUnmuted Account (MastodonResult Relationship)
| AppRegistered (MastodonResult AppRegistration)
| AutoSearch (MastodonResult (List Account))
| AutoSearch (MastodonResult SearchResults)
| Blocks Bool (MastodonResult (List Account))
| CurrentUser (MastodonResult Account)
| FavoriteAdded (MastodonResult Status)

4
src/Update/Mastodon.elm

@ -381,10 +381,10 @@ update msg ({ accountInfo, search } as model) =
{ draft
| showAutoMenu =
Update.Draft.showAutoMenu
decoded
decoded.accounts
draft.autoAtPosition
draft.autoQuery
, autoAccounts = decoded
, autoAccounts = decoded.accounts
}
}
-- Force selection of the first item after each

Loading…
Cancel
Save