diff --git a/app/controllers/topics_controller.rb b/app/controllers/topics_controller.rb index 4961793ffa9..ef0cd8ba69d 100644 --- a/app/controllers/topics_controller.rb +++ b/app/controllers/topics_controller.rb @@ -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 diff --git a/spec/controllers/topics_controller_spec.rb b/spec/controllers/topics_controller_spec.rb index 05a7b504778..452470abdae 100644 --- a/spec/controllers/topics_controller_spec.rb +++ b/spec/controllers/topics_controller_spec.rb @@ -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)