From 50ee7646fdefc69d418862dd2154690062ca2f25 Mon Sep 17 00:00:00 2001 From: Nicolas Perriault Date: Fri, 5 May 2017 23:47:25 +0200 Subject: [PATCH] Fix #127: Avoid requesting relationships without providing ids. --- src/Command.elm | 15 +++++++++------ src/Model.elm | 2 +- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/Command.elm b/src/Command.elm index fa1e600..07ab046 100644 --- a/src/Command.elm +++ b/src/Command.elm @@ -230,13 +230,16 @@ requestRelationships client ids = loadRelationships : Maybe Client -> List Int -> Cmd Msg loadRelationships client ids = - case client of - Just client -> - requestRelationships client ids - |> send (MastodonEvent << AccountRelationships) + if List.length ids > 0 then + case client of + Just client -> + requestRelationships client ids + |> send (MastodonEvent << AccountRelationships) - Nothing -> - Cmd.none + Nothing -> + Cmd.none + else + Cmd.none loadThread : Maybe Client -> Status -> Cmd Msg diff --git a/src/Model.elm b/src/Model.elm index 459e200..537990d 100644 --- a/src/Model.elm +++ b/src/Model.elm @@ -670,7 +670,7 @@ processMastodonEvent msg model = ! [ Command.loadRelationships model.client <| List.map .id decoded ] Err error -> - { model | errors = (errorText error) :: model.errors } ! [] + { model | errors = (errorText (Debug.log "error" error)) :: model.errors } ! [] AccountFollowing result -> case result of