fix(contacts): invalidate contacts cache after push/move operations

The /api/contacts/detailed endpoint has a 60s cache. Without invalidation
after push-to-device or move-to-cache, the UI showed stale data until
cache expired, making it look like the operation didn't work.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
MarekWo
2026-03-24 18:25:03 +01:00
parent 9ee63188d2
commit 0973d2d714

View File

@@ -2747,6 +2747,8 @@ def push_contact_to_device(public_key):
return jsonify({'success': False, 'error': 'Device manager unavailable'}), 500 return jsonify({'success': False, 'error': 'Device manager unavailable'}), 500
result = dm.push_to_device(public_key.strip().lower()) result = dm.push_to_device(public_key.strip().lower())
if result['success']:
invalidate_contacts_cache()
status = 200 if result['success'] else 400 status = 200 if result['success'] else 400
return jsonify(result), status return jsonify(result), status
except Exception as e: except Exception as e:
@@ -2763,6 +2765,8 @@ def move_contact_to_cache(public_key):
return jsonify({'success': False, 'error': 'Device manager unavailable'}), 500 return jsonify({'success': False, 'error': 'Device manager unavailable'}), 500
result = dm.move_to_cache(public_key.strip().lower()) result = dm.move_to_cache(public_key.strip().lower())
if result['success']:
invalidate_contacts_cache()
status = 200 if result['success'] else 400 status = 200 if result['success'] else 400
return jsonify(result), status return jsonify(result), status
except Exception as e: except Exception as e: