FIX: regression unable to dismiss unread

This commit is contained in:
Sam 2016-12-06 08:49:29 +11:00
parent 007408c285
commit 1135e00c83
2 changed files with 7 additions and 1 deletions

View File

@ -574,7 +574,7 @@ class TopicsController < ApplicationController
topic_ids = params[:topic_ids].map {|t| t.to_i}
elsif params[:filter] == 'unread'
tq = TopicQuery.new(current_user)
topics = TopicQuery.unread_filter(tq.joined_topic_user).listable_topics
topics = TopicQuery.unread_filter(tq.joined_topic_user, staff: guardian.is_staff?).listable_topics
topics = topics.where('category_id = ?', params[:category_id]) if params[:category_id]
topic_ids = topics.pluck(:id)
else

View File

@ -1224,6 +1224,12 @@ describe TopicsController do
expect { xhr :put, :bulk, topic_ids: topic_ids, operation: {}}.to raise_error(ActionController::ParameterMissing)
end
it "can find unread" do
# mark all unread muted
xhr :put, :bulk, filter: 'unread', operation: {type: :change_notification_level, notification_level_id: 0}
expect(response.status).to eq(200)
end
it "delegates work to `TopicsBulkAction`" do
topics_bulk_action = mock
TopicsBulkAction.expects(:new).with(user, topic_ids, operation, group: nil).returns(topics_bulk_action)