Add-remove-add favorite results in a permanently favorited session
The problem has to do with this code and the soft-deletion of Favorites. Could probably be remedied by changing removeFavorite to soft delete all the favorites and createFavorite to only add a favorite object if one isn't already there, otherwise it should undelete it.
I'm not fixing this right now because I'm not really sure why soft deletion and an array of objects is even needed.
public func removeFavorite(for session: Session) {
guard let favorite = session.favorites.first else { return }
modify(favorite) { bgFavorite in
bgFavorite.isDeleted = true
}
}
*only happens when favoriting from the session actions. Using the table context menu appears to have a different implementation.
only add a favorite object if one isn't already there, otherwise it should undelete it
This seems like a good solution
I'm not fixing this right now because I'm not really sure why soft deletion and an array of objects is even needed.
That combination made syncing significantly easier to implement.
Is work on this issue needed? I cannot tell reading your comments :)
Yes, this is still a bug. A minor logic update should be all that is needed. I think there are 2 places where add/remove favorite logic is implemented. 1 for the session list and another for the session detail. The table menu handles things correctly.
- [ ] Must unify logic for (un)favoriting a session if possible
- [ ] Must ensure both places can correctly (un)favorite sessions
Alright. I think I can pick this up once #499 is approved / merged.
Must unify logic for (un)favoriting a session if possible
It should be possible to abstract this to ConfCore and have a single implementation that's just a simple method to favorite/unfavorite which just does the right thing.