fix redirects around getting_started and aspect/index

This commit is contained in:
danielgrippi
2011-08-03 17:48:46 -07:00
parent 987d334764
commit 99ac976594
10 changed files with 18 additions and 31 deletions

View File

@@ -122,6 +122,6 @@ class ApplicationController < ActionController::Base
end
def after_sign_in_path_for(resource)
stored_location_for(:user) || aspects_path
stored_location_for(:user) || (current_user.getting_started? ? getting_started_path : aspects_path)
end
end

View File

@@ -22,12 +22,6 @@ class AspectsController < ApplicationController
aspect_ids = @aspects.map{|a| a.id}
# redirect to signup
if current_user.getting_started == true && !request.format.mobile? && !request.format.js?
redirect_to getting_started_path
return
end
# redirect to aspects creation
if @aspects.blank?
redirect_to new_aspect_path

View File

@@ -37,7 +37,7 @@ class ProfilesController < ApplicationController
if current_user.update_profile params[:profile]
flash[:notice] = I18n.t 'profiles.update.updated'
if current_user.getting_started?
redirect_to getting_started_path(:step => params[:getting_started].to_i+1)
redirect_to getting_started_path
else
redirect_to edit_profile_path
end

View File

@@ -17,7 +17,7 @@ module GettingStartedHelper
# @return [Boolean] The user has connected at least one service
def has_connected_services?
AppConfig[:connected_services].blank? || current_user.services.size > 0
AppConfig[:configured_services].blank? || current_user.services.size > 0
end
# @return [Boolean] The user has at least 3 contacts

View File

@@ -135,11 +135,11 @@
%p
= link_to "#diaspora", tag_path('diaspora')
%br
= link_to "#kittens", tag_path('kittens')
= link_to "#art", tag_path('art')
%br
= link_to "#puppies", tag_path('puppies')
= link_to "#gif", tag_path('gif')
%br
= link_to "#maddog", tag_path('maddog')
= link_to "#french", tag_path('french')
.clearfix
%br
%br
@@ -161,7 +161,7 @@
%li{:style => 'text-align:center;'}
%p
= link_to t('.skip'), getting_started_completed_path
= link_to t('.finished'), getting_started_completed_path, :class => "button"
/.span-5.rightBar.last
/ = render 'selected_contacts', :people => @selected_people.sample(20), :count => @contact_count

View File

@@ -780,7 +780,7 @@ en:
welcome: "Welcome!"
welcome_with_name: "Welcome, %{name}!"
skip: "Skip getting started"
finished: "Finished"
fill_out_your_profile: "Fill out your profile"
profile_description: "Make it easier for people to find you by filling out your profile information."

View File

@@ -21,7 +21,7 @@ Feature: invitation acceptance
| profile_gender | diasporian |
And I press "Update Profile"
And I should see "Welcome"
When I follow "Skip getting started"
When I follow "Finished"
Then I should be on the aspects page
Scenario: accept invitation from user
@@ -45,6 +45,6 @@ Feature: invitation acceptance
| profile_gender | diasporian |
And I press "Update Profile"
And I should see "Welcome"
When I follow "Skip getting started"
When I follow "Finished"
Then I should be on the aspects page

View File

@@ -25,16 +25,11 @@ Feature: new user registration
And I wait for the ajax to finish
Then I should see "Profile updated"
And I should see "Welcome"
And I follow "Skip getting started"
And I follow "Finished"
Then I should be on the aspects page
And I should not see "Skip getting started"
And I should not see "Finished"
Scenario: new user skips the setup wizard and returns to the setup wizard
When I follow "Skip getting started"
And I go to the getting started page
Then I should not see "skip getting started"
Scenario: new user skips the setup wizard
When I follow "Skip getting started"
When I follow "Finished"
Then I should be on the aspects page

View File

@@ -77,14 +77,12 @@ describe AspectsController do
alice.getting_started = true
alice.save
end
it 'redirects to getting_started' do
get :index
response.should redirect_to getting_started_path
end
it 'does not redirect mobile users to getting_started' do
get :index, :format => :mobile
response.should_not be_redirect
end
it 'does not redirect ajax to getting_started' do
get :index, :format => :js
response.should_not be_redirect

View File

@@ -30,7 +30,7 @@ describe GettingStartedHelper do
describe "#has_connected_services?" do
before do
AppConfig[:connected_services] = ['fake_service']
AppConfig[:configured_services] = ['fake_service']
end
it 'returns true if the current user has connected at least one service' do
@@ -38,8 +38,8 @@ describe GettingStartedHelper do
has_connected_services?.should be_true
end
it 'returns true if the current user has zero connected services and the server has no services to connect' do
AppConfig[:connected_services] = []
it 'returns true if the current user has zero connected services and the server has no services configured' do
AppConfig[:configured_services] = []
@current_user.services.delete_all
has_connected_services?.should be_true
end