FIX: Don't show bots as post readers
This commit is contained in:
parent
f87d38fc7c
commit
ff355ad204
|
@ -8,6 +8,7 @@ class PostReadersController < ApplicationController
|
|||
ensure_can_see_readers!(post)
|
||||
|
||||
readers = User
|
||||
.real
|
||||
.where(staged: false)
|
||||
.where.not(id: post.user_id)
|
||||
.joins(:topic_users)
|
||||
|
|
|
@ -88,6 +88,15 @@ describe PostReadersController do
|
|||
|
||||
expect(readers).to be_empty
|
||||
end
|
||||
|
||||
it "doesn't include bots" do
|
||||
TopicUser.create!(user: Discourse.system_user, topic: @group_message, last_read_post_number: 4)
|
||||
|
||||
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