forked from shadowfacts/Tusker
Deduplicate updated timeline positions when handling remote changes
This commit is contained in:
parent
ae7962ae50
commit
f9e619d9e7
|
@ -507,10 +507,11 @@ class MastodonCachePersistentStore: NSPersistentCloudKitContainer {
|
|||
let req = NSPersistentHistoryChangeRequest.fetchHistory(after: self.lastRemoteChangeToken)
|
||||
self.backgroundContext.performAndWait {
|
||||
if let result = try? self.backgroundContext.execute(req) as? NSPersistentHistoryResult,
|
||||
let transactions = result.result as? [NSPersistentHistoryTransaction] {
|
||||
let transactions = result.result as? [NSPersistentHistoryTransaction],
|
||||
!transactions.isEmpty {
|
||||
var changedHashtags = false
|
||||
var changedInstances = false
|
||||
var changedTimelinePositions: [NSManagedObjectID] = []
|
||||
var changedTimelinePositions = Set<NSManagedObjectID>()
|
||||
var changedAccountPrefs = false
|
||||
outer: for transaction in transactions {
|
||||
for change in transaction.changes ?? [] {
|
||||
|
@ -519,7 +520,7 @@ class MastodonCachePersistentStore: NSPersistentCloudKitContainer {
|
|||
} else if change.changedObjectID.entity.name == "SavedInstance" {
|
||||
changedInstances = true
|
||||
} else if change.changedObjectID.entity.name == "TimelinePosition" {
|
||||
changedTimelinePositions.append(change.changedObjectID)
|
||||
changedTimelinePositions.insert(change.changedObjectID)
|
||||
} else if change.changedObjectID.entity.name == "AccountPreferences" {
|
||||
changedAccountPrefs = true
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue