Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle unsupported transaction #631

Merged
merged 5 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions src/components/AChat/QuotedMessage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 14 additions & 2 deletions src/lib/chat/helpers/normalizeMessage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 || ''
Expand All @@ -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
Expand All @@ -90,12 +96,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
Expand Down
3 changes: 2 additions & 1 deletion src/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 2 additions & 1 deletion src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 transaction type is not supported. Please refresh the page or install the latest version of the app."
},
"common": {
"cancel": "Cancel",
Expand Down
3 changes: 2 additions & 1 deletion src/locales/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@
"you_reacted": "Отреагировали",
"partner_reacted": "Отреагировал",
"you_removed_reaction": "Убрали реакцию",
"partner_removed_reaction": "Убрал реакцию"
"partner_removed_reaction": "Убрал реакцию",
"unsupported_transaction_type": "Данный тип транзакции не поддерживается. Пожалуйста, обновите страницу, либо установите последнюю версию приложения."
},
"common": {
"cancel": "Отменить",
Expand Down
3 changes: 2 additions & 1 deletion src/locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "取消",
Expand Down
Loading