From 4adc7aa6c7da5fcf440aad4dec54c136b7b9a72f Mon Sep 17 00:00:00 2001 From: vchikalkin Date: Mon, 11 Aug 2025 15:00:48 +0300 Subject: [PATCH] feat: enhance Telegram notification heading for order updates - Updated the heading emoji logic to display a checkered flag for completed orders and a pencil for updates, improving clarity in notifications. - Added specific handling for completed records in the notification heading to differentiate between updated and completed statuses. --- src/api/order/content-types/order/lifecycles.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/api/order/content-types/order/lifecycles.ts b/src/api/order/content-types/order/lifecycles.ts index 6f728b5..2ac7689 100644 --- a/src/api/order/content-types/order/lifecycles.ts +++ b/src/api/order/content-types/order/lifecycles.ts @@ -69,13 +69,20 @@ async function sendTelegramNotification(orderEntity: Order, isUpdate = false) { const emojiForState = EMOJI_MAP[state] || ''; const stateLabel = STATE_MAP[state] || state; - // Эмодзи в заголовке: карандаш при обновлении, иначе эмодзи статуса - const headingEmoji = isUpdate ? '✏️' : emojiForState; + // Эмодзи в заголовке: карандаш при обновлении, флаг для завершенных, иначе эмодзи статуса + const headingEmoji = isUpdate + ? (state === 'completed' ? '🏁' : '✏️') + : emojiForState; let heading = ''; if (isUpdate) { - heading = `${headingEmoji} Запись изменена`; + // Специальная обработка для завершенных записей + if (state === 'completed') { + heading = `${headingEmoji} Запись завершена`; + } else { + heading = `${headingEmoji} Запись изменена`; + } } else { const isApproved = state === 'approved'; const creationText = isApproved