Merge pull request #4838 from vinothkannans/fix/read

FIX: 'read' filter in top menu showing new topics
This commit is contained in:
Robin Ward 2017-05-01 11:21:13 -04:00 committed by GitHub
commit b99aedeccc
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