diff --git a/app/controllers/post_appeals_controller.rb b/app/controllers/post_appeals_controller.rb index 15ac81715..c3becd1a4 100644 --- a/app/controllers/post_appeals_controller.rb +++ b/app/controllers/post_appeals_controller.rb @@ -10,7 +10,7 @@ class PostAppealsController < ApplicationController def index @search = PostAppeal.search(params[:search]) - @post_appeals = @search.paginate(:page => params[:page]) + @post_appeals = @search.paginate(params[:page]) end def create diff --git a/app/controllers/post_appeals_controller_test.rb b/app/controllers/post_appeals_controller_test.rb deleted file mode 100644 index e69de29bb..000000000 diff --git a/app/controllers/post_flags_controller.rb b/app/controllers/post_flags_controller.rb index fdea1151e..fb6c3619f 100644 --- a/app/controllers/post_flags_controller.rb +++ b/app/controllers/post_flags_controller.rb @@ -10,7 +10,7 @@ class PostFlagsController < ApplicationController def index @search = PostFlag.search(params[:search]) - @post_flags = @search.paginate(:page => params[:page]) + @post_flags = @search.paginate(params[:page]) end def create diff --git a/app/helpers/post_votes_helper.rb b/app/helpers/post_votes_helper.rb index 5a2094324..026b19399 100644 --- a/app/helpers/post_votes_helper.rb +++ b/app/helpers/post_votes_helper.rb @@ -9,6 +9,6 @@ module PostVotesHelper added = current.post_id_array - prev.post_id_array removed = prev.post_id_array - current.post_id_array - added.map {|x| '+' + x + ''}.join(" ") + removed.map {|x| '' + x + ''}.join(" ") + added.map {|x| '+' + x.to_s + ''}.join(" ") + removed.map {|x| '' + x.to_s + ''}.join(" ") end end diff --git a/app/models/pool_version.rb b/app/models/pool_version.rb index 7da30aeb6..ef8712566 100644 --- a/app/models/pool_version.rb +++ b/app/models/pool_version.rb @@ -3,6 +3,7 @@ class PoolVersion < ActiveRecord::Base validates_presence_of :updater_id, :updater_ip_addr belongs_to :pool + belongs_to :updater, :class_name => "User" before_validation :initialize_updater def initialize_updater diff --git a/app/views/layouts/default.html.erb b/app/views/layouts/default.html.erb index d903323f6..1ed3e6d0e 100644 --- a/app/views/layouts/default.html.erb +++ b/app/views/layouts/default.html.erb @@ -44,7 +44,6 @@ <%= nav_link_to("Forum", forum_topics_path, :class => (CurrentUser.user.has_forum_been_updated? ? "forum-updated" : nil)) %> <% if CurrentUser.is_janitor? %> <%= nav_link_to("Dashboard", moderator_dashboard_path) %> - <%= nav_link_to("Queue", moderator_post_dashboard_path) %> <% end %> <%= nav_link_to("»".html_safe, site_map_path) %> diff --git a/app/views/pool_versions/index.html.erb b/app/views/pool_versions/index.html.erb index ef577ad9d..c38226cc4 100644 --- a/app/views/pool_versions/index.html.erb +++ b/app/views/pool_versions/index.html.erb @@ -1,10 +1,11 @@
-

Pool History: <%= @pool_version.name %>

+

Pool History

+ @@ -16,7 +17,8 @@ <% @pool_versions.each do |pool_version| %> - + +
Pool Post Count Changes Updater
<%= link_to pool_version.post_id_array.size, pool_version_path(pool_version) %><%= pool_version.pool.name %><%= link_to pool_version.post_id_array.size, pool_versions_path(pool_version) %> <%= pool_version_diff(pool_version) %> <%= link_to pool_version.updater.name, user_path(pool_version.updater) %> @@ -30,11 +32,11 @@ <% end %>
+ +
+ <%= numbered_paginator(@pool_versions) %> +
-
- <%= sequential_paginator(@pool_versions) %> -
- <%= render :partial => "pools/secondary_links" %> diff --git a/app/views/posts/partials/common/_secondary_links.html.erb b/app/views/posts/partials/common/_secondary_links.html.erb index 6776f6278..89f668099 100644 --- a/app/views/posts/partials/common/_secondary_links.html.erb +++ b/app/views/posts/partials/common/_secondary_links.html.erb @@ -10,7 +10,7 @@ <% end %>
  • <%= link_to "Changes", post_versions_path %>
  • Approvals
  • -
  • <%= link_to "Moderate", moderation_post_dashboard_path %>
  • +
  • <%= link_to "Moderate", moderator_post_dashboard_path %>
  • Help
  • <% end %> diff --git a/test/functional/pool_elements_controller_test.rb b/test/functional/pool_elements_controller_test.rb index d779fda52..e76087142 100644 --- a/test/functional/pool_elements_controller_test.rb +++ b/test/functional/pool_elements_controller_test.rb @@ -23,7 +23,7 @@ class PoolElementsControllerTest < ActionController::TestCase end should "add a post to a pool once and only once" do - @pool.add_post!(@post) + @pool.add!(@post) post :create, {:pool_id => @pool.id, :post_id => @post.id, :format => "json"}, {:user_id => @user.id} @pool.reload assert_equal([@post.id], @pool.post_id_array) @@ -32,7 +32,7 @@ class PoolElementsControllerTest < ActionController::TestCase context "destroy action" do setup do - @pool.add_post!(@post) + @pool.add!(@post) end should "remove a post from a pool" do @@ -42,7 +42,7 @@ class PoolElementsControllerTest < ActionController::TestCase end should "do nothing if the post is not a member of the pool" do - @pool.remove_post!(@post) + @pool.remove!(@post) post :destroy, {:pool_id => @pool.id, :post_id => @post.id, :format => "json"}, {:user_id => @user.id} @pool.reload assert_equal([], @pool.post_id_array) diff --git a/test/functional/pool_versions_controller_test.rb b/test/functional/pool_versions_controller_test.rb index bd311b146..e7fe5235d 100644 --- a/test/functional/pool_versions_controller_test.rb +++ b/test/functional/pool_versions_controller_test.rb @@ -16,10 +16,16 @@ class PoolVersionsControllerTest < ActionController::TestCase context "index action" do setup do @pool = Factory.create(:pool) - CurrentUser.id = 20 - @pool.versions.create(:post_ids => "1 2") - CurrentUser.id = 30 - @pool.versions.create(:post_ids => "1 2 3 4") + @user_2 = Factory.create(:user) + @user_3 = Factory.create(:user) + + CurrentUser.scoped(@user_2, "1.2.3.4") do + @pool.update_attributes(:post_ids => "1 2") + end + + CurrentUser.scoped(@user_3, "5.6.7.8") do + @pool.update_attributes(:post_ids => "1 2 3 4") + end end should "list all versions" do @@ -30,7 +36,7 @@ class PoolVersionsControllerTest < ActionController::TestCase end should "list all versions that match the search criteria" do - get :index, {:search => {:updater_id_equals => "20"}} + get :index, {:search => {:updater_id_equals => @user_2.id}} assert_response :success assert_not_nil(assigns(:pool_versions)) assert_equal(1, assigns(:pool_versions).size) diff --git a/test/functional/pools_controller_test.rb b/test/functional/pools_controller_test.rb index 61ec1c7b2..c89a92893 100644 --- a/test/functional/pools_controller_test.rb +++ b/test/functional/pools_controller_test.rb @@ -75,18 +75,20 @@ class PoolsControllerTest < ActionController::TestCase context "revert action" do setup do - @pool = Factory.create(:pool, :post_ids => "1") + @post_2 = Factory.create(:post) + @pool = Factory.create(:pool, :post_ids => "#{@post.id}") CurrentUser.ip_addr = "1.2.3.4" # this is to get around the version collation - @pool.update_attributes(:post_ids => "1 2") + @pool.update_attributes(:post_ids => "#{@post.id} #{@post_2.id}") CurrentUser.ip_addr = "127.0.0.1" end should "revert to a previous version" do + assert_equal(2, PoolVersion.count) version = @pool.versions(true).first - assert_equal("1", version.post_ids) + assert_equal("#{@post.id}", version.post_ids) post :revert, {:id => @pool.id, :version_id => version.id} @pool.reload - assert_equal("1", @pool.post_ids) + assert_equal("#{@post.id}", @pool.post_ids) end end end diff --git a/test/functional/post_moderation_controller_test.rb b/test/functional/post_moderation_controller_test.rb deleted file mode 100644 index f01b58425..000000000 --- a/test/functional/post_moderation_controller_test.rb +++ /dev/null @@ -1,75 +0,0 @@ -require "test_helper" - -class PostModerationControllerTest < ActionController::TestCase - context "The post moderation controller" do - setup do - @mod = Factory.create(:moderator_user) - CurrentUser.user = @mod - CurrentUser.ip_addr = "127.0.0.1" - end - - teardown do - CurrentUser.user = nil - CurrentUser.ip_addr = nil - end - - context "delete action" do - setup do - @post = Factory.create(:post) - end - - should "delete a post" do - post :delete, {:post_id => @post.id, :format => "js"}, {:user_id => @mod.id} - @post.reload - assert_equal(true, @post.is_deleted?) - end - end - - context "undelete action" do - setup do - @post = Factory.create(:post, :is_deleted => true) - end - - should "undelete a post" do - post :undelete, {:post_id => @post.id, :format => "js"}, {:user_id => @mod.id} - @post.reload - assert_equal(false, @post.is_deleted?) - end - end - - context "moderate action" do - setup do - @post = Factory.create(:post, :is_pending => true) - end - - should "list all pending posts" do - get :moderate, {}, {:user_id => @mod.id} - assert_response :success - end - end - - context "approve action" do - setup do - @post = Factory.create(:post, :is_pending => true) - end - - should "approve a post" do - post :approve, {:post_id => @post.id}, {:user_id => @mod.id} - @post.reload - assert(!@post.is_pending?) - end - end - - context "disapprove action" do - setup do - @post = Factory.create(:post, :is_pending => true) - end - - should "disapprove a post" do - assert_difference("PostDisapproval.count", 1) do - post :disapprove, {:post_id => @post.id}, {:user_id => @mod.id} - end - end - end - end -end