diff --git a/app/controllers/admin/feedback_controller.rb b/app/controllers/admin/feedback_controller.rb index 501e933ada..d00fab6cbf 100644 --- a/app/controllers/admin/feedback_controller.rb +++ b/app/controllers/admin/feedback_controller.rb @@ -103,18 +103,6 @@ def update end end - def article - @article = Article.find(params[:id]) - if params[:ham] && params[:spam].blank? - @feedback = @article.comments.ham - end - if params[:spam] && params[:ham].blank? - @feedback = @article.comments.spam - end - @feedback ||= @article.comments - end - - def change_state return unless request.xhr? @@ -139,7 +127,6 @@ def change_state def bulkops ids = (params[:feedback_check]||{}).keys.map(&:to_i) items = Feedback.find(ids) - @unexpired = true bulkop = params[:bulkop_top].empty? ? params[:bulkop_bottom] : params[:bulkop_top] case bulkop @@ -189,13 +176,12 @@ def delete_all_spam def update_feedback(items, method) items.each do |value| value.send(method) - @unexpired && value.invalidates_cache? or next + value.invalidates_cache? or next flush_cache end end def flush_cache - @unexpired = false PageCache.sweep_all end diff --git a/app/views/admin/feedback/index.html.erb b/app/views/admin/feedback/index.html.erb index 1f47a52bbf..b3b5f27cef 100644 --- a/app/views/admin/feedback/index.html.erb +++ b/app/views/admin/feedback/index.html.erb @@ -5,7 +5,7 @@
<%= link_to(_("All"), controller: 'admin/feedback', action: :index) %> -   +   <%= link_to(_("Unapproved comments"), controller: 'admin/feedback', action: :index, confirmed: 'f') %>   @@ -21,41 +21,40 @@ <%= link_to(_("Presumed spam"), controller: 'admin/feedback', action: :index, published: 'f') %>   -
- - <%= submit_tag(_("Search"), {:class => 'btn'}) %> +
+ + <%= submit_tag(_("Search"), {:class => 'btn'}) %> +
-
<% end %> -<%= form_tag({:action => 'bulkops'}) do %> -<%= render 'button', { :position => 'top' } %> +<%= form_tag({action: 'bulkops'}) do %> + <%= render 'button', { position: 'top' } %> + <%= hidden_field_tag "search", params[:search]%> + <%= hidden_field_tag "page", params[:page]%> -<%= hidden_field_tag "search", params[:search]%> -<%= hidden_field_tag "page", params[:page]%> + + + + + + + + + + + <%= render_void_table(@feedback.size, 5) %> -
<%= _("Status")%><%= _("Comment Author")%><%= _("Comment")%><%= _("Article")%>
- - + <% @feedback.each do |comment| %> + <%= render 'feedback', {comment: comment} %> + <% end %> + <%= display_pagination(@feedback, 5) %> + - - - - + - - <%= render_void_table(@feedback.size, 5) %> - - <% @feedback.each do |comment| %> - <%= render 'feedback', {:comment => comment} %> - <% end %> - <%= display_pagination(@feedback, 5) %> - - - - -
<%= _("Status")%><%= _("Comment Author")%><%= _("Comment")%><%= _("Article")%><%= _("Select all") %>
<%= _("Select all") %>
-<%= render 'button', { :position => 'bottom' } %> + + <%= render 'button', { position: 'bottom' } %> <% end %>
diff --git a/spec/controllers/admin/feedback_controller_spec.rb b/spec/controllers/admin/feedback_controller_spec.rb index 5d34fdf153..0b6e30c124 100644 --- a/spec/controllers/admin/feedback_controller_spec.rb +++ b/spec/controllers/admin/feedback_controller_spec.rb @@ -135,50 +135,6 @@ def should_success_with_index(response) get :index, :page => '' should_success_with_index(response) end - - end - - describe 'article action' do - - def should_success_with_article_view(response) - response.should be_success - response.should render_template('article') - end - - it 'should see all feedback on one article' do - article = FactoryGirl.create(:article) - FactoryGirl.create(:comment, :article => article) - FactoryGirl.create(:comment, :article => article) - get :article, :id => article.id - should_success_with_article_view(response) - assigns(:article).should == article - assigns(:feedback).size.should == 2 - end - - it 'should see only spam feedback on one article' do - article = FactoryGirl.create(:article) - FactoryGirl.create(:comment, :state => 'spam', :article => article) - get :article, :id => article.id, :spam => 'y' - should_success_with_article_view(response) - assigns(:article).should == article - assigns(:feedback).size.should == 1 - end - - it 'should see only ham feedback on one article' do - article = FactoryGirl.create(:article) - comment = FactoryGirl.create(:comment, :article => article) - get :article, :id => article.id, :ham => 'y' - should_success_with_article_view(response) - assigns(:article).should == article - assigns(:feedback).size.should == 1 - end - - it 'should redirect_to index if bad article id' do - lambda{ - get :article, :id => 102302 - }.should raise_error(ActiveRecord::RecordNotFound) - end - end describe 'create action' do