FIX: Do not show staged users avatars when expanding the read count indicator
This commit is contained in:
parent
a25869969a
commit
bd930a9c77
|
@ -10,6 +10,7 @@ class PostReadersController < ApplicationController
|
|||
|
||||
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 @@ describe PostReadersController do
|
|||
|
||||
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)
|
||||
|
|
Loading…
Reference in New Issue