Add consistency to timeline names.
This commit is contained in:
parent
68fc8e5bfd
commit
8344d63f47
|
@ -10,7 +10,7 @@ module Command
|
||||||
, loadAccount
|
, loadAccount
|
||||||
, loadAccountFollowers
|
, loadAccountFollowers
|
||||||
, loadAccountFollowing
|
, loadAccountFollowing
|
||||||
, loadUserTimeline
|
, loadHomeTimeline
|
||||||
, loadLocalTimeline
|
, loadLocalTimeline
|
||||||
, loadGlobalTimeline
|
, loadGlobalTimeline
|
||||||
, loadAccountTimeline
|
, loadAccountTimeline
|
||||||
|
@ -256,15 +256,15 @@ loadThread client status =
|
||||||
Cmd.none
|
Cmd.none
|
||||||
|
|
||||||
|
|
||||||
loadUserTimeline : Maybe Client -> Maybe String -> Cmd Msg
|
loadHomeTimeline : Maybe Client -> Maybe String -> Cmd Msg
|
||||||
loadUserTimeline client url =
|
loadHomeTimeline client url =
|
||||||
case client of
|
case client of
|
||||||
Just client ->
|
Just client ->
|
||||||
HttpBuilder.get (Maybe.withDefault ApiUrl.homeTimeline url)
|
HttpBuilder.get (Maybe.withDefault ApiUrl.homeTimeline url)
|
||||||
|> withClient client
|
|> withClient client
|
||||||
|> withBodyDecoder (Decode.list statusDecoder)
|
|> withBodyDecoder (Decode.list statusDecoder)
|
||||||
|> withQueryParams [ ( "limit", "60" ) ]
|
|> withQueryParams [ ( "limit", "60" ) ]
|
||||||
|> send (MastodonEvent << UserTimeline (url /= Nothing))
|
|> send (MastodonEvent << HomeTimeline (url /= Nothing))
|
||||||
|
|
||||||
Nothing ->
|
Nothing ->
|
||||||
Cmd.none
|
Cmd.none
|
||||||
|
@ -315,7 +315,7 @@ loadAccountTimeline client accountId url =
|
||||||
loadTimelines : Maybe Client -> Cmd Msg
|
loadTimelines : Maybe Client -> Cmd Msg
|
||||||
loadTimelines client =
|
loadTimelines client =
|
||||||
Cmd.batch
|
Cmd.batch
|
||||||
[ loadUserTimeline client Nothing
|
[ loadHomeTimeline client Nothing
|
||||||
, loadLocalTimeline client Nothing
|
, loadLocalTimeline client Nothing
|
||||||
, loadGlobalTimeline client Nothing
|
, loadGlobalTimeline client Nothing
|
||||||
, loadNotifications client Nothing
|
, loadNotifications client Nothing
|
||||||
|
@ -329,7 +329,7 @@ loadNextTimeline client currentView id next =
|
||||||
loadNotifications client (Just next)
|
loadNotifications client (Just next)
|
||||||
|
|
||||||
"home-timeline" ->
|
"home-timeline" ->
|
||||||
loadUserTimeline client (Just next)
|
loadHomeTimeline client (Just next)
|
||||||
|
|
||||||
"local-timeline" ->
|
"local-timeline" ->
|
||||||
loadLocalTimeline client (Just next)
|
loadLocalTimeline client (Just next)
|
||||||
|
|
|
@ -57,7 +57,7 @@ init flags location =
|
||||||
{ server = ""
|
{ server = ""
|
||||||
, registration = flags.registration
|
, registration = flags.registration
|
||||||
, client = flags.client
|
, client = flags.client
|
||||||
, userTimeline = emptyTimeline "home-timeline"
|
, homeTimeline = emptyTimeline "home-timeline"
|
||||||
, localTimeline = emptyTimeline "local-timeline"
|
, localTimeline = emptyTimeline "local-timeline"
|
||||||
, globalTimeline = emptyTimeline "global-timeline"
|
, globalTimeline = emptyTimeline "global-timeline"
|
||||||
, accountTimeline = emptyTimeline "account-timeline"
|
, accountTimeline = emptyTimeline "account-timeline"
|
||||||
|
@ -139,7 +139,7 @@ updateTimelinesWithBoolFlag statusId flag statusUpdater model =
|
||||||
{ timeline | entries = List.map update timeline.entries }
|
{ timeline | entries = List.map update timeline.entries }
|
||||||
in
|
in
|
||||||
{ model
|
{ model
|
||||||
| userTimeline = updateTimeline model.userTimeline
|
| homeTimeline = updateTimeline model.homeTimeline
|
||||||
, accountTimeline = updateTimeline model.accountTimeline
|
, accountTimeline = updateTimeline model.accountTimeline
|
||||||
, localTimeline = updateTimeline model.localTimeline
|
, localTimeline = updateTimeline model.localTimeline
|
||||||
, globalTimeline = updateTimeline model.globalTimeline
|
, globalTimeline = updateTimeline model.globalTimeline
|
||||||
|
@ -215,7 +215,7 @@ deleteStatusFromAllTimelines : Int -> Model -> Model
|
||||||
deleteStatusFromAllTimelines id model =
|
deleteStatusFromAllTimelines id model =
|
||||||
-- TODO: delete from thread timeline & notifications
|
-- TODO: delete from thread timeline & notifications
|
||||||
{ model
|
{ model
|
||||||
| userTimeline = deleteStatusFromTimeline id model.userTimeline
|
| homeTimeline = deleteStatusFromTimeline id model.homeTimeline
|
||||||
, localTimeline = deleteStatusFromTimeline id model.localTimeline
|
, localTimeline = deleteStatusFromTimeline id model.localTimeline
|
||||||
, globalTimeline = deleteStatusFromTimeline id model.globalTimeline
|
, globalTimeline = deleteStatusFromTimeline id model.globalTimeline
|
||||||
, accountTimeline = deleteStatusFromTimeline id model.accountTimeline
|
, accountTimeline = deleteStatusFromTimeline id model.accountTimeline
|
||||||
|
@ -704,10 +704,10 @@ processMastodonEvent msg model =
|
||||||
Err error ->
|
Err error ->
|
||||||
{ model | errors = (errorText error) :: model.errors } ! []
|
{ model | errors = (errorText error) :: model.errors } ! []
|
||||||
|
|
||||||
UserTimeline append result ->
|
HomeTimeline append result ->
|
||||||
case result of
|
case result of
|
||||||
Ok { decoded, links } ->
|
Ok { decoded, links } ->
|
||||||
{ model | userTimeline = updateTimeline append decoded links model.userTimeline } ! []
|
{ model | homeTimeline = updateTimeline append decoded links model.homeTimeline } ! []
|
||||||
|
|
||||||
Err error ->
|
Err error ->
|
||||||
{ model | errors = (errorText error) :: model.errors } ! []
|
{ model | errors = (errorText error) :: model.errors } ! []
|
||||||
|
@ -769,7 +769,7 @@ processWebSocketMsg msg model =
|
||||||
Mastodon.WebSocket.StatusUpdateEvent result ->
|
Mastodon.WebSocket.StatusUpdateEvent result ->
|
||||||
case result of
|
case result of
|
||||||
Ok status ->
|
Ok status ->
|
||||||
{ model | userTimeline = prependToTimeline status model.userTimeline } ! []
|
{ model | homeTimeline = prependToTimeline status model.homeTimeline } ! []
|
||||||
|
|
||||||
Err error ->
|
Err error ->
|
||||||
{ model | errors = error :: model.errors } ! []
|
{ model | errors = error :: model.errors } ! []
|
||||||
|
|
|
@ -57,7 +57,7 @@ type MastodonMsg
|
||||||
| StatusDeleted (MastodonResult Int)
|
| StatusDeleted (MastodonResult Int)
|
||||||
| StatusPosted (MastodonResult Status)
|
| StatusPosted (MastodonResult Status)
|
||||||
| Unreblogged (MastodonResult Status)
|
| Unreblogged (MastodonResult Status)
|
||||||
| UserTimeline Bool (MastodonResult (List Status))
|
| HomeTimeline Bool (MastodonResult (List Status))
|
||||||
|
|
||||||
|
|
||||||
type WebSocketMsg
|
type WebSocketMsg
|
||||||
|
@ -162,7 +162,7 @@ type alias Model =
|
||||||
{ server : String
|
{ server : String
|
||||||
, registration : Maybe AppRegistration
|
, registration : Maybe AppRegistration
|
||||||
, client : Maybe Client
|
, client : Maybe Client
|
||||||
, userTimeline : Timeline Status
|
, homeTimeline : Timeline Status
|
||||||
, localTimeline : Timeline Status
|
, localTimeline : Timeline Status
|
||||||
, globalTimeline : Timeline Status
|
, globalTimeline : Timeline Status
|
||||||
, accountTimeline : Timeline Status
|
, accountTimeline : Timeline Status
|
||||||
|
|
|
@ -47,8 +47,8 @@ timelineView ( label, iconName, currentUser, timeline ) =
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
userTimelineView : CurrentUser -> Timeline Status -> Html Msg
|
homeTimelineView : CurrentUser -> Timeline Status -> Html Msg
|
||||||
userTimelineView currentUser timeline =
|
homeTimelineView currentUser timeline =
|
||||||
Lazy.lazy timelineView
|
Lazy.lazy timelineView
|
||||||
( "Home timeline"
|
( "Home timeline"
|
||||||
, "home"
|
, "home"
|
||||||
|
@ -94,7 +94,7 @@ homepageView model =
|
||||||
Just currentUser ->
|
Just currentUser ->
|
||||||
div [ class "row" ]
|
div [ class "row" ]
|
||||||
[ Lazy.lazy sidebarView model
|
[ Lazy.lazy sidebarView model
|
||||||
, userTimelineView currentUser model.userTimeline
|
, homeTimelineView currentUser model.homeTimeline
|
||||||
, Lazy.lazy3
|
, Lazy.lazy3
|
||||||
notificationListView
|
notificationListView
|
||||||
currentUser
|
currentUser
|
||||||
|
|
Loading…
Reference in New Issue