From 855586c3205b1d4b3d2e009edae3d6f848eb4b52 Mon Sep 17 00:00:00 2001 From: Satindar Dhillon Date: Sun, 24 Apr 2022 21:36:52 -0700 Subject: [PATCH] associate highlight to linked item when created --- .../Sources/Services/InternalModels/InternalHighlight.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apple/OmnivoreKit/Sources/Services/InternalModels/InternalHighlight.swift b/apple/OmnivoreKit/Sources/Services/InternalModels/InternalHighlight.swift index 16994232b..26e93b9f0 100644 --- a/apple/OmnivoreKit/Sources/Services/InternalModels/InternalHighlight.swift +++ b/apple/OmnivoreKit/Sources/Services/InternalModels/InternalHighlight.swift @@ -58,7 +58,9 @@ struct InternalHighlight: Encodable { oldHighlightsIds: [String] = [] ) { context.perform { - _ = asManagedObject(context: context, associatedItemID: associatedItemID) + let highlight = asManagedObject(context: context, associatedItemID: associatedItemID) + let linkedItem = LinkedItem.lookup(byID: associatedItemID, inContext: context) + linkedItem?.addToHighlights(highlight) if !oldHighlightsIds.isEmpty { let fetchRequest: NSFetchRequest = Highlight.fetchRequest()