Closes #6731 - fixed BookmarkNode minus operator and deleteOperation

staging
cesar 5 years ago committed by Emily Kager
parent d955eae4e2
commit 4422e3ed39

@ -15,5 +15,9 @@ val Context.bookmarkStorage: PlacesBookmarksStorage
* Removes [children] from [BookmarkNode.children] and returns the new modified [BookmarkNode].
*/
operator fun BookmarkNode.minus(children: Set<BookmarkNode>): BookmarkNode {
return this.copy(children = this.children?.filter { it !in children })
return this.copy(children = this.children?.filter { filtered ->
children.none {
it.guid == filtered.guid
}
})
}

@ -254,7 +254,7 @@ class BookmarkFragment : LibraryPageFragment<BookmarkNode>(), UserInteractionHan
bookmarkInteractor.onBookmarksChanged(bookmarkTree)
val deleteOperation: (suspend () -> Unit) = {
deleteSelectedBookmarks(selected)
deleteSelectedBookmarks(pendingBookmarksToDelete)
pendingBookmarkDeletionJob = null
// Since this runs in a coroutine, we can't depend upon the fragment still being attached
metrics?.track(Event.RemoveBookmarks)

Loading…
Cancel
Save