Skip to content

Commit

Permalink
Merge pull request #565 from Adamant-im/revert-561-feat/inconsistent-tx
Browse files Browse the repository at this point in the history
Revert "feat(Transaction): show inconsistent status if it's a duplicate"
  • Loading branch information
bludnic authored Nov 26, 2023
2 parents 885007c + 0287881 commit caa4ff6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 17 deletions.
17 changes: 0 additions & 17 deletions src/mixins/transaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,23 +126,6 @@ export default {
return status
}

const partnerId =
admSpecialMessage.recipientId === this.$store.state.address
? admSpecialMessage.senderId
: admSpecialMessage.recipientId
const messages = this.$store.getters['chat/messages'](partnerId)
const originalTxIndex = messages.findIndex(
(message) => message.hash === admSpecialMessage.hash
)
const currentTxIndex = messages.indexOf(admSpecialMessage)
const isDuplicate = originalTxIndex !== currentTxIndex
if (isDuplicate) {
status.status = TS.INVALID
status.virtualStatus = TS.INVALID

return status
}

const getterName = type.toLowerCase() + '/transaction'
const getter = this.$store.getters[getterName]
if (!getter) return status
Expand Down
13 changes: 13 additions & 0 deletions src/store/modules/chat/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,19 @@ const mutations = {
return
}

// Shouldn't duplicate third-party crypto transactions
if (
message.type &&
message.type !== 'message' &&
message.type !== 'reaction' &&
message.type !== Cryptos.ADM
) {
const localTransaction = chat.messages.find(
(localTransaction) => localTransaction.hash === message.hash
)
if (localTransaction) return
}

// use unshift when loading chat history
if (unshift) {
chat.messages.unshift(message)
Expand Down

0 comments on commit caa4ff6

Please sign in to comment.