Reduce welcome email to minimal text

Instead, redirect newly-confirmed users to the welcome
page. If confirmation is not required, redirect immediately
and don't send an email.
This commit is contained in:
John Firebaugh 2013-07-15 17:53:03 -07:00
parent e3aaa6dd4b
commit 2690342b08
7 changed files with 10 additions and 92 deletions

View file

@ -90,15 +90,14 @@ class UserController < ApplicationController
if @user.status == "active"
flash[:notice] = t 'user.new.flash welcome', :email => @user.email
Notifier.signup_confirm(@user, nil).deliver
session[:referer] = welcome_path
successful_login(@user)
else
flash[:notice] = t 'user.new.flash create success message', :email => @user.email
session[:token] = @user.tokens.create.token
Notifier.signup_confirm(@user, @user.tokens.create(:referer => session.delete(:referer))).deliver
Notifier.signup_confirm(@user, @user.tokens.create(:referer => welcome_path)).deliver
redirect_to :action => 'login', :referer => params[:referer]
end

View file

@ -6,18 +6,10 @@ class Notifier < ActionMailer::Base
def signup_confirm(user, token)
with_recipient_locale user do
# If we are passed an email address verification token, create
# the confirumation URL for account activation.
#
# Otherwise the email has already been verified e.g. through
# a trusted openID provider and the account is active and a
# confirmation URL is not needed.
if token
@url = url_for(:host => SERVER_URL,
:controller => "user", :action => "confirm",
:display_name => user.display_name,
:confirm_string => token.token)
end
mail :to => user.email,
:subject => I18n.t('notifier.signup_confirm.subject')

View file

@ -2,23 +2,8 @@
<p><%= t("notifier.signup_confirm.created", :site_url => SERVER_URL) %></p>
<% if @url -%>
<p><%= t("notifier.signup_confirm.confirm") %></p>
<p><%= link_to @url, @url %></p>
<% end -%>
<p><%= t("notifier.signup_confirm.welcome") %></p>
<p><%= raw(t("notifier.signup_confirm_html.introductory_video", :introductory_video_link => link_to(t('notifier.signup_confirm_html.video_to_openstreetmap'), "http://showmedo.com/videos/video?name=1800000&fromSeriesID=180"))) %>
<%= raw(t("notifier.signup_confirm_html.more_videos", :more_videos_link => link_to(t('notifier.signup_confirm_html.more_videos_here'), "http://showmedo.com/videos/series?name=mS2P1ZqS6"))) %></p>
<p><%= raw(t("notifier.signup_confirm_html.get_reading")) %></p>
<p><%= raw(t("notifier.signup_confirm_html.ask_questions")) %></p>
<p><%= raw(t("notifier.signup_confirm_html.wiki_signup")) %></p>
<p><%= raw(t("notifier.signup_confirm_html.user_wiki_page")) %></p>
<p><%= raw(t("notifier.signup_confirm_html.current_user")) %></p>

View file

@ -2,41 +2,8 @@
<%= fp(t("notifier.signup_confirm.created", :site_url => SERVER_URL)) %>
<% if @url -%>
<%= fp(t("notifier.signup_confirm.confirm")) %>
<%= @url %>
<% end -%>
<%= fp(t("notifier.signup_confirm.welcome")) %>
<%= fp(t("notifier.signup_confirm_plain.introductory_video")) %>
http://showmedo.com/videos/video?name=1800000&fromSeriesID=180
<%= fp(t("notifier.signup_confirm_plain.more_videos")) %>
http://showmedo.com/videos/series?name=mS2P1ZqS6
<%= fp(t("notifier.signup_confirm_plain.the_wiki")) %>
<%= t("notifier.signup_confirm_plain.the_wiki_url") %>
<%= fp(t("notifier.signup_confirm_plain.blog_and_twitter")) %>
http://blog.openstreetmap.org/
http://twitter.com/openstreetmap
<%= fp(t("notifier.signup_confirm_plain.ask_questions")) %>
http://help.openstreetmap.org/
<%= fp(t("notifier.signup_confirm_plain.wiki_signup")) %>
<%= t("notifier.signup_confirm_plain.wiki_signup_url") %>
<%= fp(t("notifier.signup_confirm_plain.user_wiki_page")) %>
<%= fp(t("notifier.signup_confirm_plain.current_user")) %>
http://wiki.openstreetmap.org/wiki/Category:Users_by_geographical_region

View file

@ -1262,28 +1262,7 @@ en:
greeting: "Hi there!"
created: "Someone (hopefully you) just created an account at %{site_url}."
confirm: "Before we do anything else, we need to confirm that this request came from you, so if it did then please click the link below to confirm your account:"
welcome: "We would like to welcome you and provide you with some additional information to get you started."
signup_confirm_plain:
introductory_video: "You can watch an introductory video to OpenStreetMap here:"
more_videos: "There are more videos here:"
the_wiki: "Get reading about OpenStreetMap on the wiki:"
the_wiki_url: "http://wiki.openstreetmap.org/wiki/Beginners%27_guide"
blog_and_twitter: "Catch up with the latest news via the OpenStreetMap blog or Twitter:"
ask_questions: "You can ask any questions you may have about OpenStreetMap at our question and answer site:"
wiki_signup: "You may also want to sign up to the OpenStreetMap wiki at:"
wiki_signup_url: "http://wiki.openstreetmap.org/index.php?title=Special:Userlogin&type=signup&returnto=Main_Page"
user_wiki_page: "It is recommended that you create a user wiki page, which includes category tags noting where you are, such as [[Category:Users_in_London]]."
current_user: "A list of current users in categories, based on where in the world they are, is available from:"
signup_confirm_html:
introductory_video: "You can watch an %{introductory_video_link}."
video_to_openstreetmap: "introductory video to OpenStreetMap"
more_videos: "There are %{more_videos_link}."
more_videos_here: "more videos here"
get_reading: Get reading about OpenStreetMap <a href="http://wiki.openstreetmap.org/wiki/Beginners%27_guide">on the wiki</a>, and catch up with the latest news via the <a href="http://blog.openstreetmap.org/">OpenStreetMap blog</a> or <a href="http://twitter.com/openstreetmap">Twitter</a>.
ask_questions: You can ask any questions you may have about OpenStreetMap at our <a href="http://help.openstreetmap.org/">question and answer site</a>.
wiki_signup: 'You may also want to <a href="http://wiki.openstreetmap.org/index.php?title=Special:Userlogin&type=signup&returnto=Main_Page">sign up to the OpenStreetMap wiki</a>.'
user_wiki_page: 'It is recommended that you create a user wiki page, which includes category tags noting where you are, such as <a href="http://wiki.openstreetmap.org/wiki/Category:Users_in_London">[[Category:Users_in_London]]</a>.'
current_user: 'A list of current users in categories, based on where in the world they are, is available from <a href="http://wiki.openstreetmap.org/wiki/Category:Users_by_geographical_region">Category:Users_by_geographical_region</a>.'
welcome: "After you confirm your account, we'll provide you with some additional information to get you started."
email_confirm:
subject: "[OpenStreetMap] Confirm your email address"
email_confirm_plain:

View file

@ -125,7 +125,7 @@ OpenStreetMap::Application.routes.draw do
match '/edit' => 'site#edit', :via => :get
match '/copyright/:copyright_locale' => 'site#copyright', :via => :get
match '/copyright' => 'site#copyright', :via => :get
match '/welcome' => 'site#welcome', :via => :get
match '/welcome' => 'site#welcome', :via => :get, :as => :welcome
match '/history' => 'changeset#list', :via => :get
match '/history/feed' => 'changeset#feed', :via => :get, :format => :atom
match '/export' => 'site#index', :export => true, :via => :get

View file

@ -140,10 +140,8 @@ class UserCreationTest < ActionController::IntegrationTest
post 'user/confirm', { :confirm_string => confirm_string, :confirm_action => 'submit' }
assert_response :redirect # to trace/mine in original referrer
follow_redirect!
assert_response :redirect # but it not redirects to /user/<display_name>/traces
follow_redirect!
assert_response :success
assert_template 'trace/list'
assert_template 'site/welcome'
end
def test_user_create_openid_success
@ -235,9 +233,7 @@ class UserCreationTest < ActionController::IntegrationTest
post 'user/confirm', { :confirm_string => confirm_string, :confirm_action => 'submit' }
assert_response :redirect # to trace/mine in original referrer
follow_redirect!
assert_response :redirect # but it not redirects to /user/<display_name>/traces
follow_redirect!
assert_response :success
assert_template "trace/list"
assert_template 'site/welcome'
end
end