mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Filter readers avatars correctly when the post is a whisper
This commit is contained in:
@@ -77,11 +77,10 @@ describe PostReadersController do
|
||||
expect(readers).to be_empty
|
||||
end
|
||||
|
||||
it "doesn't include non-members when the post is a whisper" do
|
||||
it "doesn't include non-staff users when the post is a whisper" do
|
||||
@post.update(post_type: Post.types[:whisper])
|
||||
non_member_reader = Fabricate(:user)
|
||||
@group_message.allowed_users << non_member_reader
|
||||
TopicUser.create!(user: non_member_reader, topic: @group_message, last_read_post_number: 4)
|
||||
non_staff_user = Fabricate(:user)
|
||||
TopicUser.create!(user: non_staff_user, topic: @group_message, last_read_post_number: 4)
|
||||
|
||||
get '/post_readers.json', params: { id: @post.id }
|
||||
readers = JSON.parse(response.body)['post_readers']
|
||||
@@ -89,6 +88,17 @@ describe PostReadersController do
|
||||
expect(readers).to be_empty
|
||||
end
|
||||
|
||||
it "includes staff users when the post is a whisper" do
|
||||
@post.update(post_type: Post.types[:whisper])
|
||||
admin = Fabricate(:admin)
|
||||
TopicUser.create!(user: admin, topic: @group_message, last_read_post_number: 4)
|
||||
|
||||
get '/post_readers.json', params: { id: @post.id }
|
||||
reader_data = JSON.parse(response.body)['post_readers'].first
|
||||
|
||||
assert_reader_is_correctly_serialized(reader_data, admin, @post)
|
||||
end
|
||||
|
||||
it "doesn't include bots" do
|
||||
TopicUser.create!(user: Discourse.system_user, topic: @group_message, last_read_post_number: 4)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user