Skip to content
Permalink
Browse files

FIX: Do not show staged users avatars when expanding the read count i…

…ndicator
  • Loading branch information...
romanrizzi committed Sep 10, 2019
1 parent a258699 commit bd930a9c77919ced40d593063bf7672b0d1bb29e
Showing with 11 additions and 0 deletions.
  1. +1 −0 app/controllers/post_readers_controller.rb
  2. +10 −0 spec/requests/post_readers_controller_spec.rb
@@ -10,6 +10,7 @@ def index

readers = User
.joins(:topic_users)
.where(staged: false)
.where.not(topic_users: { last_read_post_number: nil })
.where('topic_users.topic_id = ? AND topic_users.last_read_post_number >= ?', post.topic_id, post.post_number)
.where.not(id: post.user_id)
@@ -66,6 +66,16 @@

expect(readers).to be_empty
end

it "doesn't include staged users" do
TopicUser.create!(user: reader, topic: @group_message, last_read_post_number: 4)
reader.update(staged: true)

get '/post_readers.json', params: { id: @post.id }
readers = JSON.parse(response.body)['post_readers']

expect(readers).to be_empty
end
end

def assert_reader_is_correctly_serialized(reader_data, reader, post)

0 comments on commit bd930a9

Please sign in to comment.
You can’t perform that action at this time.