From 21d2927e50fb11176e554bbf3491425f9cb18f5f Mon Sep 17 00:00:00 2001 From: Ryan Fox Date: Sun, 10 Apr 2022 16:57:59 -0700 Subject: [PATCH] Stop using old API for mention searches This caused some errors on GoToSocial. --- src/Command.elm | 7 ++++--- src/Mastodon/ApiUrl.elm | 6 ------ src/Types.elm | 2 +- src/Update/Mastodon.elm | 4 ++-- 4 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/Command.elm b/src/Command.elm index fea68ec..0dd8a2c 100644 --- a/src/Command.elm +++ b/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) diff --git a/src/Mastodon/ApiUrl.elm b/src/Mastodon/ApiUrl.elm index 5236090..030c55b 100644 --- a/src/Mastodon/ApiUrl.elm +++ b/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" diff --git a/src/Types.elm b/src/Types.elm index 9476eb4..24b4148 100644 --- a/src/Types.elm +++ b/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) diff --git a/src/Update/Mastodon.elm b/src/Update/Mastodon.elm index abd0d3c..70f5a2e 100644 --- a/src/Update/Mastodon.elm +++ b/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