diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index af5088bc09cd809fc1f0b1d276bf5921313ae8c4..1095ae7249715974c623936f1085bc5e7e37b5d2 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -105,6 +105,6 @@ class ApplicationController < ActionController::Base end def after_sign_in_path_for(resource) - stored_location_for(:user) || aspects_path(:a_ids => current_user.aspects.where(:open => true).select(:id).all.map{|a| a.id}) + stored_location_for(:user) || aspects_path end end diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 55b235c2c8575331ac3e6e8399144ff4bffa2284..2620fa8ab860808b10555226d8a666723586884b 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -6,11 +6,7 @@ class HomeController < ApplicationController def show if current_user - if params[:home] - redirect_to :controller => 'aspects', :action => 'index' - else - redirect_to :controller => 'aspects', :action => 'index', :a_ids => current_user.aspects.where(:open => true).select(:id).all - end + redirect_to :controller => 'aspects', :action => 'index' elsif is_mobile_device? redirect_to user_session_path else diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index c2ae88714f82e6e291d102592255e96923a8a35c..141936ede45760836f2a27e4d40aa5cea4bb17e4 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -48,11 +48,6 @@ class UsersController < ApplicationController else flash[:error] = I18n.t 'users.update.language_not_changed' end - elsif u[:a_ids] - @user.aspects.update_all(:open => false) - unless u[:a_ids] == ["home"] - @user.aspects.where(:id => u[:a_ids]).update_all(:open => true) - end end end diff --git a/db/migrate/20110603233202_drop_aspects_open.rb b/db/migrate/20110603233202_drop_aspects_open.rb new file mode 100644 index 0000000000000000000000000000000000000000..7cef9e57e089a7327bd2d2c58a91dc33d6b117b8 --- /dev/null +++ b/db/migrate/20110603233202_drop_aspects_open.rb @@ -0,0 +1,10 @@ +class DropAspectsOpen < ActiveRecord::Migration + require 'db/migrate/20110202015222_add_open_to_aspects' + def self.up + AddOpenToAspects.down + end + + def self.down + AddOpenToAspects.up + end +end diff --git a/db/schema.rb b/db/schema.rb index 044cccfca191aa2458f4600bc5beaab0abc06bbc..4ca1cb48d36d2e3a4e3256a84ca8687c39013f6e 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20110603212633) do +ActiveRecord::Schema.define(:version => 20110603233202) do create_table "aspect_memberships", :force => true do |t| t.integer "aspect_id", :null => false @@ -35,14 +35,13 @@ ActiveRecord::Schema.define(:version => 20110603212633) do add_index "aspect_visibilities", ["post_id"], :name => "index_aspect_visibilities_on_post_id" create_table "aspects", :force => true do |t| - t.string "name", :null => false - t.integer "user_id", :null => false + t.string "name", :null => false + t.integer "user_id", :null => false t.datetime "created_at" t.datetime "updated_at" t.string "mongo_id" t.string "user_mongo_id" - t.boolean "contacts_visible", :default => true, :null => false - t.boolean "open", :default => false + t.boolean "contacts_visible", :default => true, :null => false end add_index "aspects", ["mongo_id"], :name => "index_aspects_on_mongo_id" diff --git a/features/embedder.feature b/features/embedder.feature index a2134415c042c0d78517ae58bf091383d68ecf60..96f08da488ffd55da4642af9d13a378f1c2a6771 100644 --- a/features/embedder.feature +++ b/features/embedder.feature @@ -5,7 +5,6 @@ # Background: # Given a user with username "bob" # When I sign in as "bob@bob.bob" -# And I have no open aspects saved # And I am on the home page # # Scenario: Youtube is fully embedded diff --git a/features/posts.feature b/features/posts.feature index bcb3efc4b438ae7b6a8c549e505b0310df8c6cea..710b14bb61d7631759b1d44744279dca0649ee46 100644 --- a/features/posts.feature +++ b/features/posts.feature @@ -14,7 +14,6 @@ Feature: posting And I have user with username "alice" in an aspect called "PostTo" And I have user with username "alice" in an aspect called "DidntPostTo" - And I have no open aspects saved And I am on the home page Scenario: post to all aspects diff --git a/features/saved_state.feature b/features/saved_state.feature deleted file mode 100644 index d327e57073387167abe6059817d5b074645ecf81..0000000000000000000000000000000000000000 --- a/features/saved_state.feature +++ /dev/null @@ -1,46 +0,0 @@ -@javascript -Feature: saved state - - Background: - Given I sign in - And I have an aspect called "Closed 1" - And I have an aspect called "Closed 2" - - Scenario: open aspects persist across sessions - Given I have an aspect called "Open 1" - And I have an aspect called "Open 2" - And I go to the aspects page - - When I follow "Open 1" - And I follow "Open 2" - Then aspect "Open 1" should be selected - And aspect "Open 2" should be selected - But aspect "Closed 1" should not be selected - And aspect "Closed 2" should not be selected - - When I sign out - And I sign in - Then I should be on the aspects page - And aspect "Open 1" should be selected - And aspect "Open 2" should be selected - But aspect "Closed 1" should not be selected - And aspect "Closed 2" should not be selected - - When I follow "All Aspects" - Then aspect "All Aspects" should be selected - - Scenario: home persists across sessions - Given I am on the aspects page - - When I follow "Closed 1" - And I follow "All Aspects" - Then aspect "All Aspects" should be selected - But aspect "Closed 1" should not be selected - And aspect "Closed 2" should not be selected - - When I sign out - And I sign in - Then I should be on the aspects page - And aspect "All Aspects" should be selected - But aspect "Closed 1" should not be selected - And aspect "Closed 2" should not be selected diff --git a/features/step_definitions/user_steps.rb b/features/step_definitions/user_steps.rb index f327e463e2e707cde61eadd908bf59cb2e7512f2..548404fb504453961bf19f8aeefd2b6dde7440f1 100644 --- a/features/step_definitions/user_steps.rb +++ b/features/step_definitions/user_steps.rb @@ -109,10 +109,6 @@ When /^I click on the contact request$/ do find(".person.request.ui-draggable a").click end -Given /^I have no open aspects saved$/ do - @me.aspects.update_all(:open => false) -end - Then /^aspect "([^"]*)" should (not )?be selected$/ do |aspect_name, not_selected| link_is_selected = evaluate_script("$('a:contains(\"#{aspect_name}\")').parent('li').hasClass('selected');") expected_value = !not_selected diff --git a/public/javascripts/aspect-filters.js b/public/javascripts/aspect-filters.js index 19557ca1c2f818296457165f2256d79d924887d8..bd3c0ef0303a23949c80baed2a031a3dbd63cc72 100644 --- a/public/javascripts/aspect-filters.js +++ b/public/javascripts/aspect-filters.js @@ -10,10 +10,6 @@ var AspectFilters = { AspectFilters.initializeSelectedGUIDS(); AspectFilters.interceptAspectLinks(); AspectFilters.interceptAspectNavLinks(); - - if($("a.home_selector").parent().hasClass("selected")){ - AspectFilters.performAspectUpdate(); - } }, initializeSelectedGUIDS: function(){ $("#aspect_nav li").each(function(){ @@ -113,23 +109,6 @@ var AspectFilters = { } return baseURL; }, - performAspectUpdate: function(){ - // update the open aspects in the user - updateURL = "/user"; - updateURL += '?'; - if(AspectFilters.selectedGUIDS.length === 0){ - updateURL += 'user[a_ids][]=home'; - } else { - for(i=0; i < AspectFilters.selectedGUIDS.length; i++){ - updateURL += 'user[a_ids][]='+ AspectFilters.selectedGUIDS[i] +'&'; - } - } - - $.ajax({ - url : updateURL, - type: "PUT" - }); - }, performAjax: function(newURL) { var post = $("#publisher textarea").val(), photos = {}; @@ -177,7 +156,6 @@ var AspectFilters = { // fade contents back in if(AspectFilters.requests === 0){ AspectFilters.fadeIn(); - AspectFilters.performAspectUpdate(); } } }); diff --git a/spec/controllers/home_controller_spec.rb b/spec/controllers/home_controller_spec.rb index 7a9609e8df5c8c55204776bbf473996d35c10125..b7af0ca326fef1bcef9e5e483446704ecad9d546 100644 --- a/spec/controllers/home_controller_spec.rb +++ b/spec/controllers/home_controller_spec.rb @@ -23,10 +23,9 @@ describe HomeController do @aspect0 = alice.aspects.all[0] @aspect1 = alice.aspects.create(:name => "Yeaaaah!") @index_params = {:a_ids => [@aspect0.id.to_s, @aspect1.id.to_s]} - alice.aspects.where(:id => @index_params[:a_ids]).update_all(:open => true) alice.save get :show - response.should redirect_to( :controller => 'aspects', :action => 'index', :a_ids => @index_params[:a_ids] ) + response.should redirect_to( :controller => 'aspects', :action => 'index') end describe "custom logging on success" do diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb index abd70bcc8f90238c98f51cabf9732f6146b928ca..18fa7c35362e74d026f410c30aa43d0750c29fb0 100644 --- a/spec/controllers/users_controller_spec.rb +++ b/spec/controllers/users_controller_spec.rb @@ -63,24 +63,6 @@ describe UsersController do response.status.should == 204 end - context "open aspects" do - before do - @index_params = {:id => @user.id, :user => {:a_ids => [@aspect.id.to_s, @aspect1.id.to_s]} } - end - - it "stores the aspect params in the user" do - put :update, @index_params - @user.reload.aspects.where(:open => true).all.to_set.should == [@aspect, @aspect1].to_set - end - - it "correctly resets the home state" do - @index_params[:user][:a_ids] = ["home"] - - put :update, @index_params - @user.aspects.where(:open => true).should == [] - end - end - context 'password updates' do before do @password_params = {:current_password => 'bluepin7',