1
0
Fork 0

Reflect status events in thread view. (#123)

This commit is contained in:
Nicolas Perriault 2017-05-03 11:47:42 +02:00 committed by GitHub
parent edf64977f2
commit 3b67a20909
1 changed files with 18 additions and 5 deletions

View File

@ -124,17 +124,30 @@ toStatusRequestBody draft =
updateTimelinesWithBoolFlag : Int -> Bool -> (Status -> Status) -> Model -> Model updateTimelinesWithBoolFlag : Int -> Bool -> (Status -> Status) -> Model -> Model
updateTimelinesWithBoolFlag statusId flag statusUpdater model = updateTimelinesWithBoolFlag statusId flag statusUpdater model =
let let
update flag status = update status =
if (Mastodon.Helper.extractReblog status).id == statusId then if (Mastodon.Helper.extractReblog status).id == statusId then
statusUpdater status statusUpdater status
else else
status status
in in
{ model { model
| userTimeline = List.map (update flag) model.userTimeline | userTimeline = List.map update model.userTimeline
, accountTimeline = List.map (update flag) model.accountTimeline , accountTimeline = List.map update model.accountTimeline
, localTimeline = List.map (update flag) model.localTimeline , localTimeline = List.map update model.localTimeline
, globalTimeline = List.map (update flag) model.globalTimeline , globalTimeline = List.map update model.globalTimeline
, currentView =
case model.currentView of
ThreadView thread ->
ThreadView
{ status = update thread.status
, context =
{ ancestors = List.map update thread.context.ancestors
, descendants = List.map update thread.context.descendants
}
}
currentView ->
currentView
} }