From 55f7baecf6625b662b144cc51acf75575e3ee93a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A2u=20Cao?= Date: Wed, 20 Mar 2024 17:21:21 +0100 Subject: [PATCH 1/7] Update caniuse --- package-lock.json | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 95d6291..341a694 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6816,7 +6816,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001332", + "version": "1.0.30001599", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001599.tgz", + "integrity": "sha512-LRAQHZ4yT1+f9LemSMeqdMpMxZcc4RMWdj4tiFe3G8tNkWK+E58g+/tzotb5cU6TbcVJLr4fySiAW7XmxQvZQA==", "dev": true, "funding": [ { @@ -6826,9 +6828,12 @@ { "type": "tidelift", "url": "https://tidelift.com/funding/github/npm/caniuse-lite" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" } - ], - "license": "CC-BY-4.0" + ] }, "node_modules/capture-exit": { "version": "2.0.0", @@ -29050,7 +29055,9 @@ } }, "caniuse-lite": { - "version": "1.0.30001332", + "version": "1.0.30001599", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001599.tgz", + "integrity": "sha512-LRAQHZ4yT1+f9LemSMeqdMpMxZcc4RMWdj4tiFe3G8tNkWK+E58g+/tzotb5cU6TbcVJLr4fySiAW7XmxQvZQA==", "dev": true }, "capture-exit": { From f5f74ae27f44b024d6fb2f9927b34b6a018388be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A2u=20Cao?= Date: Wed, 20 Mar 2024 17:22:58 +0100 Subject: [PATCH 2/7] Automatically select connected user/contributor as recipient --- app/components/add-reimbursement/component.js | 10 +++++++--- app/components/add-reimbursement/template.hbs | 3 +-- .../add-reimbursement/component-test.js | 17 ++++++++++++++++- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/app/components/add-reimbursement/component.js b/app/components/add-reimbursement/component.js index 5fc0397..16ea04c 100644 --- a/app/components/add-reimbursement/component.js +++ b/app/components/add-reimbursement/component.js @@ -27,6 +27,10 @@ export default class AddReimbursementComponent extends Component { this.exchangeRates.fetchRates(); } + get contributorId () { + return this.recipientId || this.kredits.currentUser?.id; + } + get isValidTotal () { return isValidAmount(this.total); } @@ -104,7 +108,7 @@ export default class AddReimbursementComponent extends Component { @action updateContributor (event) { - this.recipientId = event.target.value; + this.recipientId = parseInt(event.target.value); } @action @@ -136,12 +140,12 @@ export default class AddReimbursementComponent extends Component { if (!this.kredits.currentUser) { window.alert('You need to connect your RSK account first.'); return false } if (!this.kredits.currentUserIsCore) { window.alert('Only core contributors can submit reimbursements.'); return false } - const contributor = this.contributors.findBy('id', parseInt(this.recipientId)); + const contributor = this.contributors.findBy('id', this.contributorId); const attributes = { amount: parseInt(parseFloat(this.total) * 100000000), // convert to sats token: config.tokens['BTC'], - recipientId: parseInt(this.recipientId), + recipientId: this.contributorId, title: `Expenses covered by ${contributor.name}`, description: this.description, url: this.url, diff --git a/app/components/add-reimbursement/template.hbs b/app/components/add-reimbursement/template.hbs index 0e6a74c..1f80f71 100644 --- a/app/components/add-reimbursement/template.hbs +++ b/app/components/add-reimbursement/template.hbs @@ -2,8 +2,7 @@