From 2690342b08187db340afd6a6a1f4789f0f9564b7 Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Mon, 15 Jul 2013 17:53:03 -0700 Subject: [PATCH] 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. --- app/controllers/user_controller.rb | 5 ++-- app/models/notifier.rb | 16 +++-------- app/views/notifier/signup_confirm.html.erb | 15 ---------- app/views/notifier/signup_confirm.text.erb | 33 ---------------------- config/locales/en.yml | 23 +-------------- config/routes.rb | 2 +- test/integration/user_creation_test.rb | 8 ++---- 7 files changed, 10 insertions(+), 92 deletions(-) diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb index 57d2f7d13..df0c8d841 100644 --- a/app/controllers/user_controller.rb +++ b/app/controllers/user_controller.rb @@ -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 diff --git a/app/models/notifier.rb b/app/models/notifier.rb index a50922214..be6679c41 100644 --- a/app/models/notifier.rb +++ b/app/models/notifier.rb @@ -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 + @url = url_for(:host => SERVER_URL, + :controller => "user", :action => "confirm", + :display_name => user.display_name, + :confirm_string => token.token) mail :to => user.email, :subject => I18n.t('notifier.signup_confirm.subject') diff --git a/app/views/notifier/signup_confirm.html.erb b/app/views/notifier/signup_confirm.html.erb index 0c154c968..814deee91 100644 --- a/app/views/notifier/signup_confirm.html.erb +++ b/app/views/notifier/signup_confirm.html.erb @@ -2,23 +2,8 @@

<%= t("notifier.signup_confirm.created", :site_url => SERVER_URL) %>

-<% if @url -%>

<%= t("notifier.signup_confirm.confirm") %>

<%= link_to @url, @url %>

-<% end -%>

<%= t("notifier.signup_confirm.welcome") %>

- -

<%= 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"))) %>

- -

<%= raw(t("notifier.signup_confirm_html.get_reading")) %>

- -

<%= raw(t("notifier.signup_confirm_html.ask_questions")) %>

- -

<%= raw(t("notifier.signup_confirm_html.wiki_signup")) %>

- -

<%= raw(t("notifier.signup_confirm_html.user_wiki_page")) %>

- -

<%= raw(t("notifier.signup_confirm_html.current_user")) %>

diff --git a/app/views/notifier/signup_confirm.text.erb b/app/views/notifier/signup_confirm.text.erb index e52396462..aee44782d 100644 --- a/app/views/notifier/signup_confirm.text.erb +++ b/app/views/notifier/signup_confirm.text.erb @@ -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 diff --git a/config/locales/en.yml b/config/locales/en.yml index f3397411a..f1fda0603 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -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 on the wiki, and 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.' - 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 Category:Users_by_geographical_region.' + 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: diff --git a/config/routes.rb b/config/routes.rb index cf0bfd324..a53c70af9 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -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 diff --git a/test/integration/user_creation_test.rb b/test/integration/user_creation_test.rb index c565afd1e..f595ee73d 100644 --- a/test/integration/user_creation_test.rb +++ b/test/integration/user_creation_test.rb @@ -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//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//traces - follow_redirect! assert_response :success - assert_template "trace/list" + assert_template 'site/welcome' end end -- 2.39.5