Add consistency to timeline names.
This commit is contained in:
parent
68fc8e5bfd
commit
8344d63f47
@ -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)
|
||||
|
@ -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 } ! []
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user