Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ikhal: fix deleting of multiple instances #1273

Merged
merged 1 commit into from
Jun 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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