fix important upload

This commit is contained in:
user 2025-03-01 19:11:31 +03:00
parent a31a40e690
commit 4bb2d8cf1d
1 changed files with 13 additions and 11 deletions

View File

@ -3,7 +3,7 @@ from base64 import b64decode
from datetime import datetime
from base58 import b58encode
from sqlalchemy import and_, desc
from sqlalchemy import String, and_, desc, cast
from tonsdk.boc import Cell
from tonsdk.utils import Address
from app.core._config import CLIENT_TELEGRAM_BOT_USERNAME
@ -227,16 +227,18 @@ async def indexer_loop(memory, platform_found: bool, seqno: int) -> [bool, int]:
])
)
try:
for hint_message in session.query(KnownTelegramMessage).filter(
and_(
KnownTelegramMessage.chat_id == user.telegram_id,
KnownTelegramMessage.type == 'hint',
KnownTelegramMessage.meta['encrypted_content_hash'].astext == encrypted_stored_content.hash,
cast(KnownTelegramMessage.meta['encrypted_content_hash'], String) == encrypted_stored_content.hash,
KnownTelegramMessage.deleted == False
)
).all():
await user_uploader_wrapper.delete_message(hint_message.message_id)
except BaseException as e:
make_log("Indexer", f"Error while deleting hint messages: {e}" + '\n' + traceback.format_exc(), level="error")
elif encrypted_stored_content.type.startswith('onchain') and encrypted_stored_content.onchain_index == item_index:
encrypted_stored_content.type = "onchain/content" + ("_unknown" if (encrypted_stored_content.key_id is None) else "")
encrypted_stored_content.owner_address = item_owner_address.to_string(1, 1, 1)