Skip to content

Commit

Permalink
Merge pull request #1273 from pimutils/fix/1190
Browse files Browse the repository at this point in the history
ikhal: fix deleting of multiple instances
  • Loading branch information
geier authored Jun 23, 2023
2 parents e92d747 + fe5be01 commit fa5fddc
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion khal/ui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1109,12 +1109,20 @@ def toggle_delete_instance(self, uid):

def cleanup(self, data):
"""delete all events marked for deletion"""
# If we delete several recuids from the same vevent, the etag will
# change after each deletion. As we check for matching etags before
# deleting, deleting any subsequent recuids will fail.
# We therefore keep track of the etags of the events we already
# deleted.
updated_etags = {}
for part in self._deleted[ALL]:
account, href, etag = part.split('\n', 2)
self.collection.delete(href, etag, account)
for part, rec_id in self._deleted[INSTANCES]:
account, href, etag = part.split('\n', 2)
self.collection.delete_instance(href, etag, account, rec_id)
etag = updated_etags.get(href) or etag
event = self.collection.delete_instance(href, etag, account, rec_id)
updated_etags[event.href] = event.etag

def keypress(self, size, key):
binds = self._conf['keybindings']
Expand Down

0 comments on commit fa5fddc

Please sign in to comment.