Show connected user's latest update time on umbral contacts
Override updated_at on PersonResponse with max(Person, User, Settings) so the panel reflects when the connected user last changed their profile. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
73cef1df55
commit
568a78e64b
@ -102,13 +102,21 @@ async def get_people(
|
||||
)
|
||||
# umbral_name is always visible (public identity), not a shareable field
|
||||
shared_profiles[uid]["umbral_name"] = user.umbral_name
|
||||
shared_profiles[uid]["_updated_at"] = max(
|
||||
user.updated_at, user_settings.updated_at
|
||||
)
|
||||
|
||||
# Attach to response
|
||||
responses = []
|
||||
for p in people:
|
||||
resp = PersonResponse.model_validate(p)
|
||||
if p.linked_user_id and p.linked_user_id in shared_profiles:
|
||||
resp.shared_fields = shared_profiles[p.linked_user_id]
|
||||
profile = shared_profiles[p.linked_user_id]
|
||||
resp.shared_fields = profile
|
||||
# Show the latest update time across local record and connected user's profile
|
||||
remote_updated = profile.pop("_updated_at", None)
|
||||
if remote_updated and remote_updated > p.updated_at:
|
||||
resp.updated_at = remote_updated
|
||||
responses.append(resp)
|
||||
return responses
|
||||
|
||||
@ -179,6 +187,10 @@ async def get_person(
|
||||
linked_user, linked_settings, conn.sharing_overrides if conn else None
|
||||
)
|
||||
resp.shared_fields["umbral_name"] = linked_user.umbral_name
|
||||
# Show the latest update time across local record and connected user's profile
|
||||
remote_updated = max(linked_user.updated_at, linked_settings.updated_at)
|
||||
if remote_updated > person.updated_at:
|
||||
resp.updated_at = remote_updated
|
||||
return resp
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user