WIP Rename contributorId to recipientId
This commit is contained in:
@@ -15,7 +15,7 @@ export default class AddReimbursementComponent extends Component {
|
|||||||
|
|
||||||
@alias('kredits.contributorsSorted') contributors;
|
@alias('kredits.contributorsSorted') contributors;
|
||||||
|
|
||||||
@tracked contributorId = null;
|
@tracked recipientId = null;
|
||||||
@tracked title = '';
|
@tracked title = '';
|
||||||
@tracked total = '0';
|
@tracked total = '0';
|
||||||
@tracked expenses = A([]);
|
@tracked expenses = A([]);
|
||||||
@@ -86,7 +86,7 @@ export default class AddReimbursementComponent extends Component {
|
|||||||
|
|
||||||
@action
|
@action
|
||||||
updateContributor(event) {
|
updateContributor(event) {
|
||||||
this.contributorId = event.target.value;
|
this.recipientId = event.target.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
@@ -118,12 +118,12 @@ export default class AddReimbursementComponent extends Component {
|
|||||||
if (!this.kredits.currentUser) { window.alert('You need to connect your Ethereum account first.'); return false }
|
if (!this.kredits.currentUser) { window.alert('You need to connect your Ethereum account first.'); return false }
|
||||||
if (!this.kredits.currentUserIsCore) { window.alert('Only core contributors can submit reimbursements.'); return false }
|
if (!this.kredits.currentUserIsCore) { window.alert('Only core contributors can submit reimbursements.'); return false }
|
||||||
|
|
||||||
const contributor = this.contributors.findBy('id', this.contributorId);
|
const contributor = this.contributors.findBy('id', this.recipientId);
|
||||||
|
|
||||||
const attributes = {
|
const attributes = {
|
||||||
amount: parseInt(parseFloat(this.total) * 100000000), // convert to sats
|
amount: parseInt(parseFloat(this.total) * 100000000), // convert to sats
|
||||||
token: config.tokens['WBTC'],
|
token: config.tokens['WBTC'],
|
||||||
contributorId: parseInt(this.contributorId),
|
recipientId: parseInt(this.recipientId),
|
||||||
title: `Expenses covered by ${contributor.name}`,
|
title: `Expenses covered by ${contributor.name}`,
|
||||||
description: this.description,
|
description: this.description,
|
||||||
url: this.url,
|
url: this.url,
|
||||||
|
|||||||
@@ -575,7 +575,7 @@ export default Service.extend({
|
|||||||
|
|
||||||
loadReimbursementFromData(data) {
|
loadReimbursementFromData(data) {
|
||||||
const obj = Reimbursement.create(processReimbursementData(data));
|
const obj = Reimbursement.create(processReimbursementData(data));
|
||||||
obj.set('contributor', this.contributors.findBy('id', data.contributorId.toString()));
|
obj.set('contributor', this.contributors.findBy('id', data.recipientId.toString()));
|
||||||
this.removeObjectFromCollectionIfLoaded('reimbursements', obj.id);
|
this.removeObjectFromCollectionIfLoaded('reimbursements', obj.id);
|
||||||
this.reimbursements.pushObject(obj);
|
this.reimbursements.pushObject(obj);
|
||||||
return obj;
|
return obj;
|
||||||
@@ -589,7 +589,7 @@ export default Service.extend({
|
|||||||
console.debug('[kredits] add reimbursement response', data);
|
console.debug('[kredits] add reimbursement response', data);
|
||||||
const reimbursement = Reimbursement.create(attributes);
|
const reimbursement = Reimbursement.create(attributes);
|
||||||
reimbursement.setProperties({
|
reimbursement.setProperties({
|
||||||
contributor: this.contributors.findBy('id', attributes.contributorId.toString()),
|
contributor: this.contributors.findBy('id', attributes.recipientId.toString()),
|
||||||
pendingTx: data,
|
pendingTx: data,
|
||||||
confirmedAt: this.currentBlock + 40320
|
confirmedAt: this.currentBlock + 40320
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ export default function processReimbursementData(data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const otherProperties = [
|
const otherProperties = [
|
||||||
'id', 'contributorId', 'token', 'vetoed', 'ipfsHash',
|
'id', 'recipientId', 'token', 'vetoed', 'ipfsHash',
|
||||||
'expenses', 'pendingTx'
|
'expenses', 'pendingTx'
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user