[mkcal] Allow to fetch all deleted components from database. Contributes to JB#52130
Following the discussion initiated in buteo-sync-plugins-social!73 (merged), I looked at the
deletedIncidences() method in mKCal and notice that there is a bug if the given date time is invalid.
modifiedIncidences() are both checking that the
after argument is valid, while it's not the case for
deletedIncidences(). In fact, the check is commented out since the initial commit according to the blame.
For the two other routines, it doesn't make sense to pass an invalid date time, since it would mean to fetch all incidences and there is already a dedicaded routine for this. On the contrary, it makes sense for
deletedIncidences() to list all deleted incidences from a notebook and there is no way to do this at the moment except if we consider that
after argument should do it.
But there is a bug since the underlying implementation in
selectIncidences() in the case of invalid date time is only providing data to the query about the notebook uid while the
SELECT_COMPONENTS_BY_DELETED or the
SELECT_COMPONENTS_BY_DELETED_AND_NOTEBOOK are waiting for two integer values to be filled up in addition to the possible notebook uid. I've modified an existing test on deletion to highlight this. I'm fixing this by introducing two new queries in case of invalid
This could be used in the sync plugins (CalDAV and possibly Google calendar one) to properly list the deleted incidences of a given notebook and check if they are in synced with remote status, and later on being purged if in sync with upstream or reproposed for remote deletion at next sync.