More considerations for anonymous contributions on the frontend.
This commit is contained in:
parent
ad26bb1fd7
commit
560f63847e
|
@ -715,12 +715,14 @@ class ProposalContributionSchema(ma.Schema):
|
||||||
"amount",
|
"amount",
|
||||||
"date_created",
|
"date_created",
|
||||||
"addresses",
|
"addresses",
|
||||||
|
"is_anonymous",
|
||||||
)
|
)
|
||||||
|
|
||||||
proposal = ma.Nested("ProposalSchema")
|
proposal = ma.Nested("ProposalSchema")
|
||||||
user = ma.Nested("UserSchema", default=anonymous_user)
|
user = ma.Nested("UserSchema", default=anonymous_user)
|
||||||
date_created = ma.Method("get_date_created")
|
date_created = ma.Method("get_date_created")
|
||||||
addresses = ma.Method("get_addresses")
|
addresses = ma.Method("get_addresses")
|
||||||
|
is_anonymous = ma.Method("get_is_anonymous")
|
||||||
|
|
||||||
def get_date_created(self, obj):
|
def get_date_created(self, obj):
|
||||||
return dt_to_unix(obj.date_created)
|
return dt_to_unix(obj.date_created)
|
||||||
|
@ -732,6 +734,9 @@ class ProposalContributionSchema(ma.Schema):
|
||||||
return {
|
return {
|
||||||
'transparent': addresses['transparent'],
|
'transparent': addresses['transparent'],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def get_is_anonymous(self, obj):
|
||||||
|
return not obj.user
|
||||||
|
|
||||||
@post_dump
|
@post_dump
|
||||||
def stub_anonymous_user(self, data):
|
def stub_anonymous_user(self, data):
|
||||||
|
|
|
@ -26,8 +26,9 @@ export default class PaymentInfo extends React.Component<Props, State> {
|
||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { contribution, text } = this.props;
|
const { contribution } = this.props;
|
||||||
const { sendType } = this.state;
|
const { sendType } = this.state;
|
||||||
|
let text = this.props.text;
|
||||||
let address;
|
let address;
|
||||||
let memo;
|
let memo;
|
||||||
let amount;
|
let amount;
|
||||||
|
@ -103,14 +104,24 @@ export default class PaymentInfo extends React.Component<Props, State> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!text) {
|
||||||
|
if (contribution && contribution.isAnonymous) {
|
||||||
|
text = `
|
||||||
|
Thank you for contributing! Just send using whichever method works best for
|
||||||
|
you, and your contribution will show up anonymously once it's been confirmed.
|
||||||
|
`
|
||||||
|
} else {
|
||||||
|
text = `
|
||||||
|
Thank you for contributing! Just send using whichever method works best for
|
||||||
|
you, and we'll let you know once it's been confirmed.
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Form className="PaymentInfo" layout="vertical">
|
<Form className="PaymentInfo" layout="vertical">
|
||||||
<div className="PaymentInfo-text">
|
<div className="PaymentInfo-text">
|
||||||
{text ||
|
{text}
|
||||||
`
|
|
||||||
Thank you for contributing! Just send using whichever method works best for
|
|
||||||
you, and we'll let you know when your contribution has been confirmed.
|
|
||||||
`}
|
|
||||||
</div>
|
</div>
|
||||||
<Radio.Group
|
<Radio.Group
|
||||||
className="PaymentInfo-types"
|
className="PaymentInfo-types"
|
||||||
|
|
|
@ -64,11 +64,13 @@ export default class ContributionModal extends React.Component<Props, State> {
|
||||||
}
|
}
|
||||||
// If contribution is provided, update it
|
// If contribution is provided, update it
|
||||||
if (contribution !== this.props.contribution) {
|
if (contribution !== this.props.contribution) {
|
||||||
|
this.setState({ contribution: contribution || null });
|
||||||
|
}
|
||||||
|
// When the modal is closed, clear out the contribution and anonymous check
|
||||||
|
if (this.props.isVisible && !isVisible) {
|
||||||
this.setState({
|
this.setState({
|
||||||
contribution: contribution || null,
|
contribution: null,
|
||||||
hasConfirmedAnonymous: contribution
|
hasConfirmedAnonymous: false,
|
||||||
? !!contribution.user.userid
|
|
||||||
: nextState.hasConfirmedAnonymous,
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -113,9 +115,16 @@ export default class ContributionModal extends React.Component<Props, State> {
|
||||||
title="Thank you for your contribution!"
|
title="Thank you for your contribution!"
|
||||||
description={
|
description={
|
||||||
<>
|
<>
|
||||||
Your contribution should be confirmed in about 20 minutes. You can keep an
|
Your transaction should be confirmed in about 20 minutes.{' '}
|
||||||
eye on it at the{' '}
|
{isAnonymous
|
||||||
<Link to="/profile?tab=funded">funded tab on your profile</Link>.
|
? 'Once it’s confirmed, it’ll show up in the contributions tab.'
|
||||||
|
: (
|
||||||
|
<>
|
||||||
|
You can keep an eye on it at the{' '}
|
||||||
|
<Link to="/profile?tab=funded">funded tab on your profile</Link>.
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
style={{ width: '90%' }}
|
style={{ width: '90%' }}
|
||||||
|
|
|
@ -7,6 +7,7 @@ export interface Contribution {
|
||||||
amount: string;
|
amount: string;
|
||||||
dateCreated: number;
|
dateCreated: number;
|
||||||
status: 'PENDING' | 'CONFIRMED';
|
status: 'PENDING' | 'CONFIRMED';
|
||||||
|
isAnonymous: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ContributionWithAddresses extends Contribution {
|
export interface ContributionWithAddresses extends Contribution {
|
||||||
|
|
Loading…
Reference in New Issue