diff --git a/Changes b/Changes index faa33a7f6c6261fc6c7884e2d8b16fa9554b34fe..010d444e8c50589018afae56241898fe540465b7 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,18 @@ +Changes in Crabgrass 0.6.2 +-------------------------- + +Another bugfix release. This one has seen some serious speed improvements in +particular for updates that update a page. +The main user visible changes are the return of wiki diffs and stars for +comments. Also we sort group and user lists alphabetically in a number of +places now. +We also prepared the upgrade to rails 4 as much as possible. So we removed all +mods and turned the other rails 2.3 style plugins into engines that will be +compatible with rails4. We also moved all the activity tracking that was using +observers before into controllers. We now use helper classes to keep controllers +thin but trigger the action tracking from the controllers themselves. + + Changes in Crabgrass 0.6.1 -------------------------- diff --git a/app/controllers/pages/participations_controller.rb b/app/controllers/pages/participations_controller.rb index 8b6f4f8665aa8392e32bf9911dda35366f076e1d..520ccc57c7073149b07a5883db61e34cdf457339 100644 --- a/app/controllers/pages/participations_controller.rb +++ b/app/controllers/pages/participations_controller.rb @@ -82,7 +82,7 @@ class Pages::ParticipationsController < Pages::SidebarsController # watching group participations. def fetch_data return unless params[:access] && params[:id] - if params[:group] + if params[:group] && params[:group]!= 'false' @part = @page.group_participations.find(params[:id]) else @part = @page.user_participations.find(params[:id]) diff --git a/extensions/pages/task_list_page/app/controllers/tasks_controller.rb b/extensions/pages/task_list_page/app/controllers/tasks_controller.rb index 890890ce7f54a37fb498c083187db511f011db24..adf4cbbd7a5aa196cda46977c8b2e572a67dd251 100644 --- a/extensions/pages/task_list_page/app/controllers/tasks_controller.rb +++ b/extensions/pages/task_list_page/app/controllers/tasks_controller.rb @@ -71,7 +71,9 @@ class TasksController < Pages::BaseController end def task_params - params.require(:task).permit(:name, :description, :user_ids => []) + params.require(:task). + reverse_merge(user_ids: []). + permit(:name, :description, :user_ids => []) end def sort_params diff --git a/extensions/pages/task_list_page/test/functional/tasks_controller_test.rb b/extensions/pages/task_list_page/test/functional/tasks_controller_test.rb index 7ea71a9c4c3602680a451f71123c9d1050609194..40662612b0ccbd35ae69ab7a56c33c15bc84ceac 100644 --- a/extensions/pages/task_list_page/test/functional/tasks_controller_test.rb +++ b/extensions/pages/task_list_page/test/functional/tasks_controller_test.rb @@ -3,14 +3,15 @@ require 'test_helper' class TasksControllerTest < ActionController::TestCase fixtures :pages, :users, :task_lists, :tasks - def test_sort - login_as :blue - + def setup @user = users(:blue) @page = pages(:tasklist1) @page.add(@user, access: :admin) @page.save! + login_as @user + end + def test_sort assert_equal 1, Task.find(1).position assert_equal 2, Task.find(2).position assert_equal 3, Task.find(3).position @@ -24,11 +25,19 @@ class TasksControllerTest < ActionController::TestCase end def test_create_task - login_as :blue - pages(:tasklist1).add(users(:blue), access: :admin) - pages(:tasklist1).save! - assert_difference 'pages(:tasklist1).data.tasks.count' do - xhr :post, :create, page_id: pages(:tasklist1).id, task: {name: "new task", user_ids: ["5"], description: "new task description"} + assert_difference '@page.data.tasks.count' do + xhr :post, :create, page_id: @page.id, + task: {name: "new task", user_ids: ["5"], description: "new task description"} + end + end + + def test_update_task + list = @page.data + task = list.tasks.create name: 'blue... do something!', + user_ids: [@user.id] + assert_difference '@user.tasks.count', -1 do + xhr :put, :update, page_id: @page, id: task.id, + task: {name: "updated task", description: "new task description"} end end end diff --git a/extensions/pages/task_list_page/test/integration/task_list_test.rb b/extensions/pages/task_list_page/test/integration/task_list_test.rb index dc48de823a90fa052a61ea4e4bebb7729bfeae76..9edf74e213b31120263cfc3b687df111ac744887 100644 --- a/extensions/pages/task_list_page/test/integration/task_list_test.rb +++ b/extensions/pages/task_list_page/test/integration/task_list_test.rb @@ -29,7 +29,14 @@ class TaskListTest < JavascriptIntegrationTest assign_task_to users(:red) assert_task_assigned_to users(:red) unassign_task_from user - assert_task_not_assigned_to users(:blue) + assert_no_task_assigned_to users(:blue) + end + + def test_unassigning_task_from_last_user + add_task + unassign_task_from user + assert_tasks_pending + assert_no_task_assigned_to(user) end def add_task(options = {}) @@ -44,7 +51,9 @@ class TaskListTest < JavascriptIntegrationTest def unassign_task_from(user) edit_task - uncheck user.login + within '#sort_list_pending' do + uncheck user.login + end click_on 'Save' end @@ -94,7 +103,7 @@ class TaskListTest < JavascriptIntegrationTest end end - def assert_task_not_assigned_to(*users) + def assert_no_task_assigned_to(*users) users.each do |user| assert_no_selector '.people', text: user.display_name diff --git a/test/helpers/integration/javascript/page_actions.rb b/test/helpers/integration/javascript/page_actions.rb index 8388b5ceed57eb61b9689cdb69924870d4c710b3..7c98f7d3608ed4f0f29f03b8ce972c3dbd82f026 100644 --- a/test/helpers/integration/javascript/page_actions.rb +++ b/test/helpers/integration/javascript/page_actions.rb @@ -66,7 +66,11 @@ module PageActions click_on 'Page Details' find('a', text: 'Permissions').click select permission - assert_selector "#permissions_tab .tiny_#{PERMISSION_ICONS[permission]}_16" + if PERMISSION_ICONS.keys.include? permission + assert_selector "#permissions_tab .tiny_#{PERMISSION_ICONS[permission]}_16" + else + wait_for_ajax + end close_popup wait_for_ajax # reload sidebar end @@ -74,12 +78,14 @@ module PageActions def delete_page(page = @page) click_on 'Delete Page' click_button 'Delete' + wait_for_ajax # ensure after_commit callbacks are triggered so sphinx indexes the page. page.page_terms.committed! end def undelete_page(page = @page) click_on 'Undelete' + wait_for_ajax # ensure after_commit callbacks are triggered so sphinx indexes the page. page.page_terms.committed! end diff --git a/test/integration/image_test.rb b/test/integration/image_test.rb index 3138d0bc302e6aac0181e185763e9aa54b1e8367..934eff062b29300d4b5c3bb0da5ce8ec97696f15 100644 --- a/test/integration/image_test.rb +++ b/test/integration/image_test.rb @@ -2,6 +2,11 @@ require 'integration_test' class ImageTest < IntegrationTest + def setup + FileUtils.mkdir_p(ASSET_PRIVATE_STORAGE) + FileUtils.mkdir_p(ASSET_PUBLIC_STORAGE) + end + def test_get_asset asset = FactoryGirl.create :image_asset visit asset.url diff --git a/test/integration/page_sidebar_test.rb b/test/integration/page_sidebar_test.rb index de9920c0f64e149924eb41f45209b83c9f17e314..324b8d7700438f255171ee58b0a0ce811c37c34f 100644 --- a/test/integration/page_sidebar_test.rb +++ b/test/integration/page_sidebar_test.rb @@ -57,6 +57,15 @@ class PageSidebarTest < JavascriptIntegrationTest assert_page_starred end + def test_remove_user_from_page + @page.add(users(:red), access: :admin) + @page.save! + visit current_url # reload + assert_page_users users(:blue), users(:red) + change_access_to 'No Access' + assert_page_users users(:blue) + end + def test_trash path = current_path delete_page diff --git a/test/unit/profile_test.rb b/test/unit/profile_test.rb index 23dbf6e729ee2432d9470fcfe894b15813bd5aa7..66a7ac7cbf4832379c40adcc629c12e66b045dca 100644 --- a/test/unit/profile_test.rb +++ b/test/unit/profile_test.rb @@ -14,11 +14,6 @@ class ProfileTest < ActiveSupport::TestCase FileUtils.mkdir_p(ASSET_PUBLIC_STORAGE) end - def teardown - FileUtils.rm_rf(ASSET_PRIVATE_STORAGE) - FileUtils.rm_rf(ASSET_PUBLIC_STORAGE) - end - def test_adding_profile u = users(:blue) p = u.profiles.create stranger: true, first_name: 'Blue' diff --git a/test/unit/task_test.rb b/test/unit/task_test.rb index 94db9f76b108e5b8b65574b1d7d13435506df61a..6226028d56fe8f2b7b510c465b0913cc959276b7 100644 --- a/test/unit/task_test.rb +++ b/test/unit/task_test.rb @@ -1,9 +1,7 @@ require_relative 'test_helper' class TaskTest < ActiveSupport::TestCase - - def setup - end + fixtures :users def test_creation assert list = TaskList.create @@ -45,4 +43,13 @@ class TaskTest < ActiveSupport::TestCase assert_nil t.completed_at end + def test_unassigning_from_last_user + list = TaskList.create + task = list.tasks.create + task.user_ids = [users(:blue).id] + task.save + task.user_ids = [] + task.save + assert_equal [], task.user_ids + end end