diff --git a/app/controllers/public/account_controller.rb b/app/controllers/public/account_controller.rb index d35e543..4f7a3da 100644 --- a/app/controllers/public/account_controller.rb +++ b/app/controllers/public/account_controller.rb @@ -18,7 +18,6 @@ class AccountController < ApplicationController return unless request.post? self.current_user = User.authenticate(params[:user][:login], params[:user][:password]) if params[:user] if logged_in? - self.current_user.person.update_attribute(:last_lang, cookies[:lang]) if params[:remember_me] == "1" self.current_user.remember_me cookies[:auth_token] = { :value => self.current_user.remember_token , :expires => self.current_user.remember_token_expires_at } @@ -95,7 +94,6 @@ class AccountController < ApplicationController # action to perform logout from the application def logout if logged_in? - self.current_user.person.update_attribute(:last_lang, cookies[:lang]) self.current_user.forget_me end cookies.delete :auth_token diff --git a/app/models/person.rb b/app/models/person.rb index 0a7fde1..1c42921 100644 --- a/app/models/person.rb +++ b/app/models/person.rb @@ -12,15 +12,6 @@ class Person < Profile Friendship.find(:all, :conditions => { :friend_id => person.id}).each { |friendship| friendship.destroy } end - settings_items :last_lang, :type => :string - def last_lang - if self.data[:last_lang].nil? or self.data[:last_lang].empty? - Noosfero.default_locale - else - self.data[:last_lang] - end - end - def suggested_friend_groups (friend_groups.compact + [ _('friends'), _('work'), _('school'), _('family') ]).map {|i| i if !i.empty?}.compact.uniq end diff --git a/test/functional/account_controller_test.rb b/test/functional/account_controller_test.rb index 89d7a95..031178e 100644 --- a/test/functional/account_controller_test.rb +++ b/test/functional/account_controller_test.rb @@ -290,27 +290,6 @@ class AccountControllerTest < Test::Unit::TestCase assert_redirected_to :controller => 'profile_editor' end - should 'save last lang after logout' do - user = create_user('save_lang').person - assert user.update_attribute(:last_lang, 'unknow') - assert_equal 'unknow', user.last_lang - login_as user.identifier - get :logout - user.reload - assert_not_equal 'unknow', user.last_lang - assert_equal @response.cookies[:lang], user.last_lang - end - - should 'save last lang after login' do - user = create_user('save_lang').person - assert user.update_attribute(:last_lang, 'unknow') - assert_equal 'unknow', user.last_lang - - post :login, :user => {:login => 'save_lang', :password => 'save_lang'} - - assert_not_equal 'unknow', Person['save_lang'].last_lang - end - should 'signup from wizard' do assert_difference User, :count do post :signup, :user => { :login => 'mylogin', :password => 'mypassword', :password_confirmation => 'mypassword', :email => 'mylogin@example.com' }, :wizard => true diff --git a/test/unit/person_test.rb b/test/unit/person_test.rb index 537795f..bc0c539 100644 --- a/test/unit/person_test.rb +++ b/test/unit/person_test.rb @@ -44,13 +44,10 @@ class PersonTest < Test::Unit::TestCase assert p.community_memberships.include?(c), "Community should add a new member" end - should 'can have user' do + should 'be associated with a user' do u = User.new(:login => 'john', :email => 'john@doe.org', :password => 'dhoe', :password_confirmation => 'dhoe') - p = Person.new(person_data.merge(:name => 'John', :identifier => 'john')) - u.person = p - assert u.save - assert_kind_of User, p.user - assert_equal 'John', u.person.name + u.save! + assert_equal u, Person['john'].user end should 'only one person per user' do @@ -414,17 +411,6 @@ class PersonTest < Test::Unit::TestCase assert_equal p.pending_tasks_for_organization(c), c.tasks end - should 'has default locale as last lang' do - p = create_user('user_lang_test').person - assert_equal Noosfero.default_locale, p.last_lang - end - - should 'be able to change last lang' do - p = create_user('user_lang_test').person - assert p.update_attribute(:last_lang, 'pt_BR') - assert_equal 'pt_BR', Person['user_lang_test'].last_lang - end - should 'return active_person_fields' do e = Environment.default e.expects(:active_person_fields).returns(['cell_phone', 'comercial_phone']).at_least_once -- libgit2 0.21.2