Skip to content

Commit

Permalink
Merge pull request #1759 from okTurtles/sebin/task/1751-bug-with-dism…
Browse files Browse the repository at this point in the history
…issing-payments

#1751 - Dismissing a payment causes user to get banned
  • Loading branch information
taoeffect authored Oct 11, 2023
2 parents 0ecaf6b + c6683f4 commit 5694fd7
Showing 1 changed file with 2 additions and 37 deletions.
39 changes: 2 additions & 37 deletions frontend/views/containers/payments/PaymentRowTodo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,32 +31,20 @@

template(slot='cellActions')
.cpr-date(:class='payment.isLate ? "pill is-danger" : "has-text-1"') {{ humanDate(payment.date) }}
payment-actions-menu
menu-item(
tag='button'
item-id='message'
icon='times'
@click='cancelPayment'
)
i18n Dismiss this payment
</template>

<script>
import sbp from '@sbp/sbp'
import { mapGetters } from 'vuex'
import { humanDate } from '@model/contracts/shared/time.js'
import { MenuItem } from '@components/menu/index.js'
import { PAYMENT_CANCELLED, PAYMENT_NOT_RECEIVED } from '@model/contracts/shared/payments/index.js'
import { L } from '@common/common.js'
import { PAYMENT_NOT_RECEIVED } from '@model/contracts/shared/payments/index.js'
import PaymentRow from './payment-row/PaymentRow.vue'
import PaymentActionsMenu from './payment-row/PaymentActionsMenu.vue'
import PaymentNotReceivedTooltip from './payment-row/PaymentNotReceivedTooltip.vue'
export default ({
name: 'PaymentRowTodo',
components: {
MenuItem,
PaymentActionsMenu,
PaymentNotReceivedTooltip,
PaymentRow
},
Expand All @@ -80,34 +68,11 @@ export default ({
wasNotReceived () {
const { data } = this.payment
return data && data.status === PAYMENT_NOT_RECEIVED
},
hash () {
return this.payment?.hash
}
},
methods: {
humanDate,
// TODO: make multiple payments
async cancelPayment () {
try {
if (this.hash) {
await sbp('gi.actions/group/paymentUpdate', {
contractID: this.$store.state.currentGroupId,
data: {
paymentHash: this.hash,
updatedProperties: {
status: PAYMENT_CANCELLED
}
}
})
} else {
alert(L("Cannot dismiss a payment that hasn't been sent yet."))
}
} catch (e) {
console.error(e)
alert(e.message)
}
},
select () {
this.form.checked = true
},
Expand All @@ -118,7 +83,7 @@ export default ({
watch: {
'form.checked' (checked) {
this.$emit('change', {
hash: this.hash,
hash: this.payment?.hash,
checked
})
}
Expand Down

0 comments on commit 5694fd7

Please sign in to comment.