From 376c7ed70d108faf97e35101fb92d644746e1680 Mon Sep 17 00:00:00 2001 From: Ryan Fox Date: Tue, 7 Feb 2023 16:47:50 -0800 Subject: [PATCH] Limitless timelines! GoToSocial's timelines seem to be a bit fucked at the moment, and one of my accounts won't load anything unless I remove the limits. This is a workaround for that. --- src/Command.elm | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/src/Command.elm b/src/Command.elm index 0dd8a2c..7ab2b4b 100644 --- a/src/Command.elm +++ b/src/Command.elm @@ -150,7 +150,6 @@ loadNotifications client url = HttpBuilder.get (Maybe.withDefault ApiUrl.notifications url) |> withClient client |> withBodyDecoder (Decode.list notificationDecoder) - |> withQueryParams [ ( "limit", "30" ) ] |> send (MastodonEvent << Notifications (url /= Nothing)) Nothing -> @@ -255,7 +254,6 @@ searchAccounts client query limit resolve = let qs = [ ( "q", "@"++query ) - , ( "limit", toString limit ) , ( "resolve" , if resolve then "true" @@ -324,7 +322,6 @@ loadHomeTimeline client url = HttpBuilder.get (Maybe.withDefault ApiUrl.homeTimeline url) |> withClient client |> withBodyDecoder (Decode.list statusDecoder) - |> withQueryParams [ ( "limit", "60" ) ] |> send (MastodonEvent << HomeTimeline (url /= Nothing)) Nothing -> @@ -338,7 +335,6 @@ loadLocalTimeline client url = HttpBuilder.get (Maybe.withDefault ApiUrl.publicTimeline url) |> withClient client |> withBodyDecoder (Decode.list statusDecoder) - |> withQueryParams [ ( "local", "true" ), ( "limit", "60" ) ] |> send (MastodonEvent << LocalTimeline (url /= Nothing)) Nothing -> @@ -352,7 +348,6 @@ loadGlobalTimeline client url = HttpBuilder.get (Maybe.withDefault ApiUrl.publicTimeline url) |> withClient client |> withBodyDecoder (Decode.list statusDecoder) - |> withQueryParams [ ( "limit", "60" ) ] |> send (MastodonEvent << GlobalTimeline (url /= Nothing)) Nothing -> @@ -366,8 +361,7 @@ loadAccountTimeline client accountId url = HttpBuilder.get (Maybe.withDefault (ApiUrl.accountTimeline accountId) url) |> withClient client |> withBodyDecoder (Decode.list statusDecoder) - |> withQueryParams [ ( "limit", "60" ) - , ( "exclude_replies", "true" ) + |> withQueryParams [ ( "exclude_replies", "true" ) ] |> send (MastodonEvent << AccountTimeline (url /= Nothing)) @@ -382,8 +376,7 @@ loadAccountTimelineReplies client accountId url = HttpBuilder.get (Maybe.withDefault (ApiUrl.accountTimeline accountId) url) |> withClient client |> withBodyDecoder (Decode.list statusDecoder) - |> withQueryParams [ ( "limit", "60" ) - , ( "exclude_replies", "false" ) + |> withQueryParams [ ( "exclude_replies", "false" ) ] |> send (MastodonEvent << AccountTimeline (url /= Nothing)) @@ -398,7 +391,6 @@ loadFavoriteTimeline client url = HttpBuilder.get (Maybe.withDefault ApiUrl.favouriteTimeline url) |> withClient client |> withBodyDecoder (Decode.list statusDecoder) - |> withQueryParams [ ( "limit", "60" ) ] |> send (MastodonEvent << FavoriteTimeline (url /= Nothing)) Nothing -> @@ -412,7 +404,6 @@ loadHashtagTimeline client hashtag url = HttpBuilder.get (Maybe.withDefault (ApiUrl.hashtag hashtag) url) |> withClient client |> withBodyDecoder (Decode.list statusDecoder) - |> withQueryParams [ ( "limit", "60" ) ] |> send (MastodonEvent << HashtagTimeline (url /= Nothing)) Nothing -> @@ -426,7 +417,6 @@ loadMutes client url = HttpBuilder.get (Maybe.withDefault ApiUrl.mutes url) |> withClient client |> withBodyDecoder (Decode.list accountDecoder) - |> withQueryParams [ ( "limit", "60" ) ] |> send (MastodonEvent << Mutes (url /= Nothing)) Nothing -> @@ -440,7 +430,6 @@ loadBlocks client url = HttpBuilder.get (Maybe.withDefault ApiUrl.blocks url) |> withClient client |> withBodyDecoder (Decode.list accountDecoder) - |> withQueryParams [ ( "limit", "60" ) ] |> send (MastodonEvent << Blocks (url /= Nothing)) Nothing -> @@ -691,6 +680,21 @@ uploadMedia client fileInputId = Cmd.none +updateMediaDescription : Maybe Client -> String -> String -> Cmd Msg +updateMediaDescription client mediaId description = + case client of + Just { server, token } -> + Ports.updateMedia + { id = mediaId + , url = server ++ (ApiUrl.updateMedia mediaId) + , token = token + , description = description + } + + Nothing -> + Cmd.none + + focusId : String -> Cmd Msg focusId id = Dom.focus id |> Task.attempt (always NoOp)