* VRFS-711 - adding new welcome email with useful links

This commit is contained in:
Seth Call 2013-09-26 13:43:02 +00:00
parent fc13f47ce0
commit cf907cc060
11 changed files with 94 additions and 17 deletions

View File

@ -19,13 +19,24 @@
#sendgrid_enable :opentrack, :clicktrack # this makes our emails creepy, imo (seth)
sendgrid_unique_args :env => Environment.mode
def welcome_message(user, signup_confirm_url)
def confirm_email(user, signup_confirm_url)
@user = user
@signup_confirm_url = signup_confirm_url
sendgrid_category "Confirm Email"
sendgrid_unique_args :type => "confirm_email"
mail(:to => user.email, :subject => "#{user.first_name}, please confirm your JamKazam email") do |format|
format.text
format.html
end
end
def welcome_message(user)
@user = user
sendgrid_category "Welcome"
sendgrid_unique_args :type => "welcome_message"
mail(:to => user.email, :subject => "Welcome to JamKazam, #{user.first_name} ") do |format|
mail(:to => user.email, :subject => "Welcome to JamKazam, #{user.first_name}") do |format|
format.text
format.html
end

View File

@ -0,0 +1,5 @@
<% provide(:title, 'Confirm Email') %>
<p>Welcome to Jamkazam, <%= @user.first_name %>!</p>
<p>To confirm this email address, please go to the <a href="<%= @signup_confirm_url %>">signup confirmation page.</a>.</p>

View File

@ -0,0 +1,3 @@
Welcome to Jamkazam, <%= @user.first_name %>!
To confirm this email address, please go to the signup confirmation page at: <%= @signup_confirm_url %>.

View File

@ -1,4 +1,27 @@
<% provide(:title, 'Welcome to Jamkazam') %>
<% provide(:title, 'Welcome to JamKazam!') %>
<p>Welcome to Jamkazam, <%= @user.first_name %>!</p>
<p>To confirm this email address, please go to the <a href="<%= @signup_confirm_url %>">signup confirmation page.</a>.</p>
<p> We're delighted that you have decided to try the JamKazam service,
and we hope that you will enjoy using JamKazam to play music with others.
Following are links to some resources that can help to get you up and running quickly.
</p>
<p>
Tutorial videos that show you how to use the key features of the product:
<a href="https://jamkazam.desk.com/customer/portal/articles/1304097-tutorial-videos">https://jamkazam.desk.com/customer/portal/articles/1304097-tutorial-videos</a>
</p>
<p>
Getting Started knowledge base articles:
<a href="https://jamkazam.desk.com/customer/portal/topics/564807-getting-started/articles">https://jamkazam.desk.com/customer/portal/topics/564807-getting-started/articles</a>
</p>
<p>
Support Portal in case you run into trouble and need help:
<a href="https://jamkazam.desk.com/">https://jamkazam.desk.com/</a>
</p>
<p>
We look forward to seeing - and hearing - you online soon!
</p>
&nbsp;&nbsp;- Team JamKazam

View File

@ -1,3 +1,16 @@
Welcome to Jamkazam, <%= @user.first_name %>!
We're delighted that you have decided to try the JamKazam service,
and we hope that you will enjoy using JamKazam to play music with others.
Following are links to some resources that can help to get you up and running quickly.
To confirm this email address, please go to the signup confirmation page at: <%= @signup_confirm_url %>.
Tutorial videos that show you how to use the key features of the product:
https://jamkazam.desk.com/customer/portal/articles/1304097-tutorial-videos
Getting Started knowledge base articles:
https://jamkazam.desk.com/customer/portal/topics/564807-getting-started/articles
Support Portal in case you run into trouble and need help:
https://jamkazam.desk.com/
We look forward to seeing - and hearing - you online soon!
- Team JamKazam

View File

@ -723,6 +723,7 @@ module JamRuby
else
# don't send an signup email if the user was invited already *and* they used the same email that they were invited with
if !invited_user.nil? && invited_user.email.casecmp(user.email).zero?
UserMailer.welcome_message(user).deliver
else
# FIXME:
@ -731,7 +732,7 @@ module JamRuby
#
# any errors here should also rollback the transaction; that's OK. If emails aren't going to be delivered,
# it's already a really bad situation; make user signup again
UserMailer.welcome_message(user, signup_confirm_url.nil? ? nil : (signup_confirm_url + "/" + user.signup_token) ).deliver
UserMailer.confirm_email(user, signup_confirm_url.nil? ? nil : (signup_confirm_url + "/" + user.signup_token) ).deliver
end
end
end

View File

@ -25,7 +25,8 @@ describe "RenderMailers", :slow => true do
save_emails_to_disk(mail, @filename)
end
it { @filename="welcome_message"; UserMailer.welcome_message(user, "/signup").deliver }
it { @filename="welcome_message"; UserMailer.welcome_message(user).deliver }
it { @filename="confirm_email"; UserMailer.confirm_email(user, "/signup").deliver }
it { @filename="password_reset"; UserMailer.password_reset(user, '/reset_password').deliver }
it { @filename="password_changed"; UserMailer.password_changed(user).deliver }
it { @filename="updated_email"; UserMailer.updated_email(user).deliver }

View File

@ -17,14 +17,35 @@ describe UserMailer do
describe "should send welcome email" do
describe "should send confirm email" do
let (:mail) { UserMailer.deliveries[0] }
let (:signup_confirmation_url) { "http://example.com/confirm" }
let (:signup_confirmation_url_with_token ) { "#{signup_confirmation_url}/#{user.signup_token}" }
before(:each) do
UserMailer.welcome_message(user, signup_confirmation_url_with_token).deliver
UserMailer.confirm_email(user, signup_confirmation_url_with_token).deliver
end
it { UserMailer.deliveries.length.should == 1 }
it { mail['from'].to_s.should == UserMailer::DEFAULT_SENDER }
it { mail['to'].to_s.should == user.email }
it { mail.multipart?.should == true } # because we send plain + html
# verify that the messages are correctly configured
it { mail.html_part.body.include?("Welcome").should be_true }
it { mail.html_part.body.include?(signup_confirmation_url_with_token).should be_true }
it { mail.text_part.body.include?("Welcome").should be_true }
it { mail.text_part.body.include?(signup_confirmation_url_with_token).should be_true }
end
describe "should send welcome email" do
let (:mail) { UserMailer.deliveries[0] }
before(:each) do
UserMailer.welcome_message(user).deliver
end

View File

@ -36,7 +36,7 @@ class UserManager < BaseManager
@user = User.signup(first_name, last_name, email, password, password_confirmation, terms_of_service, subscribe_email,
location, instruments, birth_date, musician, photo_url, invited_user, signup_confirm_url)
return @user
return @user
#end
end

View File

@ -79,7 +79,7 @@ describe "Signup" do
it { should have_selector('h1', text: "congratulations") }
# there is no email sent though when you signup based on an invite (because you just left your email to get here)
it { UserMailer.deliveries.length.should == 0 }
it { UserMailer.deliveries.length.should == 1 }
it {uri = URI.parse(current_url); "#{uri.path}?#{uri.query}".should == congratulations_musician_path(:type => 'Native')}
end

View File

@ -162,8 +162,7 @@ describe UserManager do
@invitation.errors.any?.should be_false
@invitation.accepted.should be_true
UserMailer.deliveries.length.should == 0 # no emails should be sent, in this case
UserMailer.deliveries.length.should == 1
end
it "signup successfully with due to user invitation with no autofriend" do
@ -183,7 +182,7 @@ describe UserManager do
@invitation.errors.any?.should be_false
@invitation.accepted.should be_true
UserMailer.deliveries.length.should == 0 # no emails should be sent, in this case
UserMailer.deliveries.length.should == 1
end
it "signup successfully with due to user invitation with autofriend" do
@ -205,7 +204,7 @@ describe UserManager do
@user.friends?(@some_user).should be_true
@user.friends?(@some_user).should be_true
UserMailer.deliveries.length.should == 0 # no emails should be sent, in this case
UserMailer.deliveries.length.should == 1
end
it "signup successfully with due to user invitation with autofriend, but uses another email" do