From b24dddf6b8a3b187126c6efe0c3cf7c46c1bb805 Mon Sep 17 00:00:00 2001 From: bludnic Date: Tue, 4 Jun 2024 18:00:45 +0100 Subject: [PATCH 1/5] fix(Chat): add unsupported transaction type --- src/lib/chat/helpers/normalizeMessage.js | 8 +++++++- src/locales/en.json | 3 ++- src/locales/ru.json | 3 ++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/lib/chat/helpers/normalizeMessage.js b/src/lib/chat/helpers/normalizeMessage.js index 935c7d613..b58cad383 100644 --- a/src/lib/chat/helpers/normalizeMessage.js +++ b/src/lib/chat/helpers/normalizeMessage.js @@ -90,12 +90,18 @@ export function normalizeMessage(abstract) { transaction.type = notSupportedYetCrypto || 'UNKNOWN_CRYPTO' transaction.status = TS.UNKNOWN } - } else { + } else if (typeof abstract.message === 'string') { // ADM transaction or Message transaction.message = abstract.message || '' transaction.hash = abstract.id // adm transaction id (hash) abstract.amount > 0 ? (transaction.type = 'ADM') : (transaction.type = 'message') + } else { + // Unsupported transaction type. May require updating the PWA version. + transaction.message = 'chats.unsupported_transaction_type' + transaction.i18n = true + transaction.hash = abstract.id // adm transaction id (hash) + transaction.type = 'message' } return transaction diff --git a/src/locales/en.json b/src/locales/en.json index 8924e9271..842902a16 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -77,7 +77,8 @@ "you_reacted": "Reacted", "partner_reacted": "Reacted", "you_removed_reaction": "Removed reaction", - "partner_removed_reaction": "Removed reaction" + "partner_removed_reaction": "Removed reaction", + "unsupported_transaction_type": "This type of transaction is not supported. Please update the app to the latest version." }, "common": { "cancel": "Cancel", diff --git a/src/locales/ru.json b/src/locales/ru.json index 45720cbd9..604d03ff6 100644 --- a/src/locales/ru.json +++ b/src/locales/ru.json @@ -77,7 +77,8 @@ "you_reacted": "Отреагировали", "partner_reacted": "Отреагировал", "you_removed_reaction": "Убрали реакцию", - "partner_removed_reaction": "Убрал реакцию" + "partner_removed_reaction": "Убрал реакцию", + "unsupported_transaction_type": "Данный тип транзакции не поддерживается. Пожалуйста, обновите приложение до последней версии." }, "common": { "cancel": "Отменить", From 5490b7314381c5ea9b29170390c880b49db6ce54 Mon Sep 17 00:00:00 2001 From: bludnic Date: Tue, 4 Jun 2024 18:12:51 +0100 Subject: [PATCH 2/5] fix(Chat): handle unsupported transaction type for reply messages --- src/components/AChat/QuotedMessage.vue | 4 ++++ src/lib/chat/helpers/normalizeMessage.js | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/components/AChat/QuotedMessage.vue b/src/components/AChat/QuotedMessage.vue index 2b5ac374a..c6aa11277 100644 --- a/src/components/AChat/QuotedMessage.vue +++ b/src/components/AChat/QuotedMessage.vue @@ -123,6 +123,10 @@ export default defineComponent({ }) const messageLabel = computed(() => { + if (transaction.value.i18n) { + return t(transaction.value.message) + } + return store.state.options.formatMessages ? formatMessage(transaction.value.message) : transaction.value.message diff --git a/src/lib/chat/helpers/normalizeMessage.js b/src/lib/chat/helpers/normalizeMessage.js index b58cad383..56fbfef3f 100644 --- a/src/lib/chat/helpers/normalizeMessage.js +++ b/src/lib/chat/helpers/normalizeMessage.js @@ -51,7 +51,7 @@ export function normalizeMessage(abstract) { } else { transaction.type = 'message' } - } else { + } else if (abstract.message.reply_message.type) { // reply with a crypto transfer transaction.asset = abstract.message transaction.message = abstract.message.reply_message.comments || '' @@ -70,6 +70,12 @@ export function normalizeMessage(abstract) { transaction.type = notSupportedYetCrypto || 'UNKNOWN_CRYPTO' transaction.status = TS.UNKNOWN } + } else { + // Unsupported transaction type. May require updating the PWA version. + transaction.message = 'chats.unsupported_transaction_type' + transaction.i18n = true + transaction.hash = abstract.id // adm transaction id (hash) + transaction.type = 'message' } transaction.isReply = true From 70ca251ea10553f13babda6edc9c00911f14f416 Mon Sep 17 00:00:00 2001 From: bludnic Date: Tue, 4 Jun 2024 18:50:46 +0100 Subject: [PATCH 3/5] refactor(i18n): update `unsupported_transaction_type` translation Co-authored-by: RealGoodProgrammer --- src/locales/en.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/locales/en.json b/src/locales/en.json index 842902a16..6e4141f49 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -78,7 +78,7 @@ "partner_reacted": "Reacted", "you_removed_reaction": "Removed reaction", "partner_removed_reaction": "Removed reaction", - "unsupported_transaction_type": "This type of transaction is not supported. Please update the app to the latest version." + "unsupported_transaction_type": "This transaction type is not supported. Please refresh the page or install the latest version of the app." }, "common": { "cancel": "Cancel", From 5dc7f45d1d337bd3d53296d7b4c1d8c874d4f4bc Mon Sep 17 00:00:00 2001 From: bludnic Date: Tue, 4 Jun 2024 18:51:59 +0100 Subject: [PATCH 4/5] fix(i18n): update `unsupported_transaction_type` translation --- src/locales/ru.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/locales/ru.json b/src/locales/ru.json index 604d03ff6..0a75463f9 100644 --- a/src/locales/ru.json +++ b/src/locales/ru.json @@ -78,7 +78,7 @@ "partner_reacted": "Отреагировал", "you_removed_reaction": "Убрали реакцию", "partner_removed_reaction": "Убрал реакцию", - "unsupported_transaction_type": "Данный тип транзакции не поддерживается. Пожалуйста, обновите приложение до последней версии." + "unsupported_transaction_type": "Данный тип транзакции не поддерживается. Пожалуйста, обновите страницу, либо установите последнюю версию приложения." }, "common": { "cancel": "Отменить", From ffe26e99c5946043d3a2f71000bbb20a8ac7dc55 Mon Sep 17 00:00:00 2001 From: bludnic Date: Tue, 4 Jun 2024 18:52:59 +0100 Subject: [PATCH 5/5] feat(i18n): add `unsupported_transaction_type` key --- src/locales/de.json | 3 ++- src/locales/zh.json | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/locales/de.json b/src/locales/de.json index 24871f12a..4fac84a98 100644 --- a/src/locales/de.json +++ b/src/locales/de.json @@ -60,7 +60,8 @@ "you_reacted": "Reacted", "partner_reacted": "Reacted", "you_removed_reaction": "Removed reaction", - "partner_removed_reaction": "Removed reaction" + "partner_removed_reaction": "Removed reaction", + "unsupported_transaction_type": "This transaction type is not supported. Please refresh the page or install the latest version of the app." }, "common": { "cancel": "Abbrechen", diff --git a/src/locales/zh.json b/src/locales/zh.json index 486b0760e..904ff88a3 100644 --- a/src/locales/zh.json +++ b/src/locales/zh.json @@ -77,7 +77,8 @@ "you_reacted": "反应", "partner_reacted": "已反应", "you_removed_reaction": "已删除反应", - "partner_removed_reaction": "已删除的反应" + "partner_removed_reaction": "已删除的反应", + "unsupported_transaction_type": "This transaction type is not supported. Please refresh the page or install the latest version of the app." }, "common": { "cancel": "取消",