Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Null Name fallback on donation thank you email. #819

Closed
LennonR opened this issue Jun 4, 2017 · 10 comments
Closed

Null Name fallback on donation thank you email. #819

LennonR opened this issue Jun 4, 2017 · 10 comments

Comments

@LennonR
Copy link

LennonR commented Jun 4, 2017

Problem

If I donate without being logged in and create an account during the donation process, I won't have a name associated with my account. So the thank you email looks like this:

screen shot 2017-06-04 at 3 30 10 pm

@begedin
Copy link
Contributor

begedin commented Jun 5, 2017

Proposed solution

  • in emails/receipt.html replace {{user_first_name}} with {{name}}
  • in lib/codecorps/emails/receipt_email.ex, add a get_name/1, which receives a user and
    • returns user.first_name
    • if that is nil, user.username
    • if that is nil, user.email
  • in lib/codecorps/emails/receipt_email.ex, in build_model/3, replace user_first_name with name, the value of which is the result of the above function
  • update any tests that break by this

@joshsmith
Copy link
Contributor

@LennonR how do you feel about the proposed solution above?

@LennonR
Copy link
Author

LennonR commented Jun 5, 2017

@joshsmith It works. I'd prefer something like "Hey {{user_first_name or 'there'}}, thanks..."

I feel like it's a bit friendlier than using somebody's email address. But not a big deal. Using email is a decent solution.

@joshsmith
Copy link
Contributor

I'd prefer this, as well. @begedin can we have that be the fallback if no first_name?

@begedin
Copy link
Contributor

begedin commented Jun 6, 2017

That's actually a great idea which I did not consider.

New proposed solution

  • in emails/receipt.html replace
<strong>{{user_first_name}}</strong>, thanks for your monthly donation to <a href="{{project_url}}">{{project_title}}</a>.

with

Hey {{name}}, thanks for your monthly donation to <a href="{{project_url}}">{{project_title}}</a>.
  • in lib/codecorps/emails/receipt_email.ex, add a get_name/1, which receives a user and

    • returns user.first_name
    • if that is nil, returns a plain "there"
  • in lib/codecorps/emails/receipt_email.ex, in build_model/3, replace user_first_name with name, the value of which is the result of the above function

  • update any tests that break by this

  • add a test for the case of the user having no first name into receipt_email_test.exs

Note

Not sure about calling the variable {{name}}, technically, it's a {{form_of_address}} but that term is uncommon to the point where I'm not sure it would make things clearer.

@joshsmith
Copy link
Contributor

{{name}} seems fine to me.

@zacck-zz
Copy link
Member

Hey everyone, I'd like to take a crack at this one.

@joshsmith
Copy link
Contributor

Hey @zacck! Go for it. Let me know if you need anything from me.

@zacck-zz
Copy link
Member

@joshsmith going for it!! 🗡

@zacck-zz
Copy link
Member

@joshsmith a review would be nice when you have a moment please. Thank you so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants