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

Revert "feat(Transaction): show inconsistent status if it's a duplicate" #565

Merged
merged 1 commit into from
Nov 26, 2023
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
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