From 3b67a209098b18c8926777647b33926c2a0ef2dc Mon Sep 17 00:00:00 2001 From: Nicolas Perriault Date: Wed, 3 May 2017 11:47:42 +0200 Subject: [PATCH] Reflect status events in thread view. (#123) --- src/Model.elm | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/Model.elm b/src/Model.elm index b3b8c26..fa80ec7 100644 --- a/src/Model.elm +++ b/src/Model.elm @@ -124,17 +124,30 @@ toStatusRequestBody draft = updateTimelinesWithBoolFlag : Int -> Bool -> (Status -> Status) -> Model -> Model updateTimelinesWithBoolFlag statusId flag statusUpdater model = let - update flag status = + update status = if (Mastodon.Helper.extractReblog status).id == statusId then statusUpdater status else status in { model - | userTimeline = List.map (update flag) model.userTimeline - , accountTimeline = List.map (update flag) model.accountTimeline - , localTimeline = List.map (update flag) model.localTimeline - , globalTimeline = List.map (update flag) model.globalTimeline + | userTimeline = List.map update model.userTimeline + , accountTimeline = List.map update model.accountTimeline + , localTimeline = List.map update model.localTimeline + , 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 }