From 8344d63f479e438d9f65ba429702bdb20d6209e8 Mon Sep 17 00:00:00 2001 From: Nicolas Perriault Date: Sat, 6 May 2017 11:15:52 +0200 Subject: [PATCH] Add consistency to timeline names. --- src/Command.elm | 12 ++++++------ src/Model.elm | 12 ++++++------ src/Types.elm | 4 ++-- src/View/App.elm | 6 +++--- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/Command.elm b/src/Command.elm index d10add9..0c43b45 100644 --- a/src/Command.elm +++ b/src/Command.elm @@ -10,7 +10,7 @@ module Command , loadAccount , loadAccountFollowers , loadAccountFollowing - , loadUserTimeline + , loadHomeTimeline , loadLocalTimeline , loadGlobalTimeline , loadAccountTimeline @@ -256,15 +256,15 @@ loadThread client status = Cmd.none -loadUserTimeline : Maybe Client -> Maybe String -> Cmd Msg -loadUserTimeline client url = +loadHomeTimeline : Maybe Client -> Maybe String -> Cmd Msg +loadHomeTimeline client url = case client of Just client -> HttpBuilder.get (Maybe.withDefault ApiUrl.homeTimeline url) |> withClient client |> withBodyDecoder (Decode.list statusDecoder) |> withQueryParams [ ( "limit", "60" ) ] - |> send (MastodonEvent << UserTimeline (url /= Nothing)) + |> send (MastodonEvent << HomeTimeline (url /= Nothing)) Nothing -> Cmd.none @@ -315,7 +315,7 @@ loadAccountTimeline client accountId url = loadTimelines : Maybe Client -> Cmd Msg loadTimelines client = Cmd.batch - [ loadUserTimeline client Nothing + [ loadHomeTimeline client Nothing , loadLocalTimeline client Nothing , loadGlobalTimeline client Nothing , loadNotifications client Nothing @@ -329,7 +329,7 @@ loadNextTimeline client currentView id next = loadNotifications client (Just next) "home-timeline" -> - loadUserTimeline client (Just next) + loadHomeTimeline client (Just next) "local-timeline" -> loadLocalTimeline client (Just next) diff --git a/src/Model.elm b/src/Model.elm index 537990d..2cad6a6 100644 --- a/src/Model.elm +++ b/src/Model.elm @@ -57,7 +57,7 @@ init flags location = { server = "" , registration = flags.registration , client = flags.client - , userTimeline = emptyTimeline "home-timeline" + , homeTimeline = emptyTimeline "home-timeline" , localTimeline = emptyTimeline "local-timeline" , globalTimeline = emptyTimeline "global-timeline" , accountTimeline = emptyTimeline "account-timeline" @@ -139,7 +139,7 @@ updateTimelinesWithBoolFlag statusId flag statusUpdater model = { timeline | entries = List.map update timeline.entries } in { model - | userTimeline = updateTimeline model.userTimeline + | homeTimeline = updateTimeline model.homeTimeline , accountTimeline = updateTimeline model.accountTimeline , localTimeline = updateTimeline model.localTimeline , globalTimeline = updateTimeline model.globalTimeline @@ -215,7 +215,7 @@ deleteStatusFromAllTimelines : Int -> Model -> Model deleteStatusFromAllTimelines id model = -- TODO: delete from thread timeline & notifications { model - | userTimeline = deleteStatusFromTimeline id model.userTimeline + | homeTimeline = deleteStatusFromTimeline id model.homeTimeline , localTimeline = deleteStatusFromTimeline id model.localTimeline , globalTimeline = deleteStatusFromTimeline id model.globalTimeline , accountTimeline = deleteStatusFromTimeline id model.accountTimeline @@ -704,10 +704,10 @@ processMastodonEvent msg model = Err error -> { model | errors = (errorText error) :: model.errors } ! [] - UserTimeline append result -> + HomeTimeline append result -> case result of Ok { decoded, links } -> - { model | userTimeline = updateTimeline append decoded links model.userTimeline } ! [] + { model | homeTimeline = updateTimeline append decoded links model.homeTimeline } ! [] Err error -> { model | errors = (errorText error) :: model.errors } ! [] @@ -769,7 +769,7 @@ processWebSocketMsg msg model = Mastodon.WebSocket.StatusUpdateEvent result -> case result of Ok status -> - { model | userTimeline = prependToTimeline status model.userTimeline } ! [] + { model | homeTimeline = prependToTimeline status model.homeTimeline } ! [] Err error -> { model | errors = error :: model.errors } ! [] diff --git a/src/Types.elm b/src/Types.elm index 0252d90..71b6250 100644 --- a/src/Types.elm +++ b/src/Types.elm @@ -57,7 +57,7 @@ type MastodonMsg | StatusDeleted (MastodonResult Int) | StatusPosted (MastodonResult Status) | Unreblogged (MastodonResult Status) - | UserTimeline Bool (MastodonResult (List Status)) + | HomeTimeline Bool (MastodonResult (List Status)) type WebSocketMsg @@ -162,7 +162,7 @@ type alias Model = { server : String , registration : Maybe AppRegistration , client : Maybe Client - , userTimeline : Timeline Status + , homeTimeline : Timeline Status , localTimeline : Timeline Status , globalTimeline : Timeline Status , accountTimeline : Timeline Status diff --git a/src/View/App.elm b/src/View/App.elm index f379f81..c8828be 100644 --- a/src/View/App.elm +++ b/src/View/App.elm @@ -47,8 +47,8 @@ timelineView ( label, iconName, currentUser, timeline ) = ] -userTimelineView : CurrentUser -> Timeline Status -> Html Msg -userTimelineView currentUser timeline = +homeTimelineView : CurrentUser -> Timeline Status -> Html Msg +homeTimelineView currentUser timeline = Lazy.lazy timelineView ( "Home timeline" , "home" @@ -94,7 +94,7 @@ homepageView model = Just currentUser -> div [ class "row" ] [ Lazy.lazy sidebarView model - , userTimelineView currentUser model.userTimeline + , homeTimelineView currentUser model.homeTimeline , Lazy.lazy3 notificationListView currentUser