FIX: 'read' filter in top menu showing new topics

This commit is contained in:
Vinoth Kannan 2017-04-26 21:56:37 +05:30
parent b76674f640
commit 1241660c2c
2 changed files with 3 additions and 1 deletions

View File

@ -165,7 +165,7 @@ class TopicQuery
def list_read
create_list(:read, unordered: true) do |topics|
topics.order('COALESCE(tu.last_visited_at, topics.bumped_at) DESC')
topics.where('tu.last_visited_at IS NOT NULL').order('tu.last_visited_at DESC')
end
end

View File

@ -458,6 +458,8 @@ describe TopicQuery do
context 'list_unread' do
it 'lists topics correctly' do
new_topic = Fabricate(:post, user: creator).topic
expect(topic_query.list_unread.topics).to eq([])
expect(topic_query.list_read.topics).to match_array([fully_read, partially_read])
end