make pledge-related notifications more specific and helpful (#9040)

* make pledge-related notifications more specific and helpful

* further improve commit flash messages

* fix minor whitespace issue
pull/9399/merge
Quincy Larson 2016-07-01 00:25:01 -07:00 committed by Jonathan
parent 94fa869a81
commit cffd7c11f4
1 changed files with 15 additions and 5 deletions

View File

@ -104,7 +104,9 @@ export default function commit(app) {
req.flash('info', {
msg: dedent`
Looks like you already have a pledge to ${pledge.displayName}.
Hitting commit here will replace your old commitment.
Clicking "Commit" here will replace your old commitment. If you
do change your commitment, please remember to cancel your
previous recurring donation directly with ${pledge.displayName}.
`
});
}
@ -169,7 +171,8 @@ export default function commit(app) {
msg: dedent`
Congratulations, you have committed to giving
${displayName} $${amount} each month until you have completed
your ${goal}.
your ${goal}. Please remember to cancel your pledge directly
with ${displayName} once you finish.
`
});
res.redirect('/' + user.username);
@ -217,11 +220,18 @@ export default function commit(app) {
})
.subscribe(
pledge => {
let msg = 'You have successfully stopped your pledge.';
let msg = dedent`
You have successfully stopped your pledge. Please
rememberto cancel your recurring donation directly
with the nonprofit if you haven't already done so.
`;
if (!pledge) {
msg = `No pledge found for user ${user.username}.`;
msg = dedent`
It doesn't look like you had an active pledge, so
there's no pledge to stop.
`;
}
req.flash('errors', { msg });
req.flash('info', { msg });
return res.redirect(`/${user.username}`);
},
next