From ec66d050da24a363988a100f2ccdfc8d2358b2b5 Mon Sep 17 00:00:00 2001 From: Antoine Nguyen Date: Fri, 12 Dec 2025 14:38:02 +0100 Subject: [PATCH 1/8] Reset addressbook sync status when sync is disabled. see #3821 --- modoboa/contacts/serializers.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modoboa/contacts/serializers.py b/modoboa/contacts/serializers.py index f1922791a..27ee2a753 100644 --- a/modoboa/contacts/serializers.py +++ b/modoboa/contacts/serializers.py @@ -235,9 +235,12 @@ class UserPreferencesSerializer(serializers.Serializer): def post_save(self, request): """Create remote cal if necessary.""" - if not self.validated_data["enable_carddav_sync"]: - return abook = request.user.addressbook_set.first() + if not self.validated_data["enable_carddav_sync"]: + abook.last_sync = None + abook.sync_token = "" + abook.save(update_fields=["last_sync", "sync_token"]) + return if abook.last_sync: return tasks.create_cdav_addressbook(abook, request.auth) From c13f4082d08ac9a8a94b667151f82b3b54693369 Mon Sep 17 00:00:00 2001 From: Antoine Nguyen Date: Fri, 12 Dec 2025 16:47:22 +0100 Subject: [PATCH 2/8] New asynchronous way to synchronize from addressbook. --- .../src/components/contacts/ContactList.vue | 262 +++++++++++------- frontend/src/views/contacts/AddressBook.vue | 24 +- .../migrations/0008_addressbook_syncing.py | 18 ++ modoboa/contacts/models.py | 1 + modoboa/contacts/serializers.py | 2 +- modoboa/contacts/tasks.py | 12 +- modoboa/contacts/viewsets.py | 4 +- 7 files changed, 204 insertions(+), 119 deletions(-) create mode 100644 modoboa/contacts/migrations/0008_addressbook_syncing.py diff --git a/frontend/src/components/contacts/ContactList.vue b/frontend/src/components/contacts/ContactList.vue index e24839567..0c42cc60a 100644 --- a/frontend/src/components/contacts/ContactList.vue +++ b/frontend/src/components/contacts/ContactList.vue @@ -1,97 +1,120 @@