Skip to content
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
26 changes: 12 additions & 14 deletions backend/indexer_gifts/actions/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,20 +82,18 @@ async def _sync_user_gifts(
existing = self.gift_service.find(ug.name)

if existing:
# If it was owned by someone else, record they lost it
if (
existing.telegram_owner_id
and existing.telegram_owner_id != telegram_user_id
):
lost_ownership_user_ids.add(existing.telegram_owner_id)

self.gift_service.update_ownership(
slug=ug.name,
telegram_owner_id=telegram_user_id,
blockchain_address=existing.blockchain_address,
owner_address=existing.owner_address,
)
updated_count += 1
# Only update if ownership actually changed
if existing.telegram_owner_id != telegram_user_id:
if existing.telegram_owner_id:
lost_ownership_user_ids.add(existing.telegram_owner_id)

self.gift_service.update_ownership(
slug=ug.name,
telegram_owner_id=telegram_user_id,
blockchain_address=existing.blockchain_address,
owner_address=existing.owner_address,
)
updated_count += 1
else:
# Ensure collection exists using in-memory cache
collection_id = int(ug.gift_id)
Expand Down
Loading