Skip to content
Extraits de code Groupes Projets
Valider 01d5c047 rédigé par danielgrippi's avatar danielgrippi
Parcourir les fichiers

DG MS; don't redirect to legacy getting started if you're a beta user

parent 13b60cc5
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -106,10 +106,17 @@ class ApplicationController < ActionController::Base ...@@ -106,10 +106,17 @@ class ApplicationController < ActionController::Base
end end
def after_sign_in_path_for(resource) def after_sign_in_path_for(resource)
stored_location_for(:user) || (current_user.getting_started? ? getting_started_path : root_path) stored_location_for(:user) || current_user_redirect_path
end end
def max_time def max_time
params[:max_time] ? Time.at(params[:max_time].to_i) : Time.now + 1 params[:max_time] ? Time.at(params[:max_time].to_i) : Time.now + 1
end end
private
def current_user_redirect_path
return person_path(current_user.person) if current_user.beta?
current_user.getting_started? ? getting_started_path : root_path
end
end end
...@@ -32,17 +32,5 @@ describe ApplicationController do ...@@ -32,17 +32,5 @@ describe ApplicationController do
response.headers['X-Git-Revision'].should == '02395' response.headers['X-Git-Revision'].should == '02395'
end end
end end
#this context is commented out because the code to do it gets applied at environment load.
#context 'without git info' do
# before do
# AppConfig.config_vars.delete(:git_update)
# AppConfig.config_vars.delete(:git_revision)
# end
# it 'does not set the headers if there is no git info' do
# get :index
# response.headers.keys.should_not include('X-Git-Update')
# response.headers.keys.should_not include('X-Git-Revision')
# end
#end
end end
end end
...@@ -251,5 +251,27 @@ describe UsersController do ...@@ -251,5 +251,27 @@ describe UsersController do
response.should be_success response.should be_success
end end
end end
# This logic lives in application controller
describe "#after_sign_in_path_for" do
before do
@controller.stub(:current_user).and_return(eve)
end
context 'getting started true on user' do
before do
eve.update_attribute(:getting_started, true)
end
it "redirects to getting started if the user has getting started set to true" do
@controller.after_sign_in_path_for(eve).should == getting_started_path
end
it "does not redirect to getting started if the user is beta" do
Role.add_beta(eve.person)
@controller.after_sign_in_path_for(eve).should == person_path(eve.person)
end
end
end
end end
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter