From e1a51b8acd329eecc59370dda707b6d173868bad Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Fri, 16 Feb 2018 21:21:27 -0800 Subject: [PATCH] =?UTF-8?q?When=20updating=20a=20timeline=20that=E2=80=99s?= =?UTF-8?q?=20already=20displaying,=20merge=20articles=20by=20articleID,?= =?UTF-8?q?=20so=20that=20updated=20versions=20replace=20older=20versions.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MainWindow/Timeline/TimelineViewController.swift | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Evergreen/MainWindow/Timeline/TimelineViewController.swift b/Evergreen/MainWindow/Timeline/TimelineViewController.swift index 98fcc179c..4de75c8db 100644 --- a/Evergreen/MainWindow/Timeline/TimelineViewController.swift +++ b/Evergreen/MainWindow/Timeline/TimelineViewController.swift @@ -705,8 +705,17 @@ private extension TimelineViewController { } performBlockAndRestoreSelection { + var unsortedArticles = fetchUnsortedArticles(for: representedObjects) - unsortedArticles.formUnion(Set(articles)) + + // Merge articles by articleID. For any unique articleID in current articles, add to unsortedArticles. + let unsortedArticleIDs = unsortedArticles.articleIDs() + for article in articles { + if !unsortedArticleIDs.contains(article.articleID) { + unsortedArticles.insert(article) + } + } + updateArticles(with: unsortedArticles) } }