Reset addressbook sync status when sync is disabled.

see #3821
This commit is contained in:
Antoine Nguyen
2025-12-12 14:38:02 +01:00
parent 5d8a224b74
commit ec66d050da
+5 -2
View File
@@ -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)