Skip to content

Commit

Permalink
FIX: TopicTrackingState.report not including unread for staff posts.
Browse files Browse the repository at this point in the history
Follow-up to e15c86e
  • Loading branch information
tgxworld committed Aug 12, 2021
1 parent 2fb17b7 commit 9a60c83
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/topic_tracking_state.rb
Expand Up @@ -385,7 +385,7 @@ def self.report_raw_sql(
if skip_unread
"1=0"
else
unread_filter_sql
unread_filter_sql(staff: staff)
end

filter_old_unread_sql =
Expand Down
23 changes: 23 additions & 0 deletions spec/models/topic_tracking_state_spec.rb
Expand Up @@ -688,4 +688,27 @@
expect(TopicTrackingState.report(post.user)).to be_empty
expect(TopicTrackingState.report(user)).to be_empty
end

describe ".report" do
it "correctly reports topics with staff posts" do
create_post(
raw: "this is a test post",
topic: topic,
user: post.user
)

create_post(
raw: "this is a test post",
topic: topic,
post_type: Post.types[:whisper],
user: user
)

post.user.grant_admin!

state = TopicTrackingState.report(post.user)

expect(state.map(&:topic_id)).to contain_exactly(topic.id)
end
end
end

0 comments on commit 9a60c83

Please sign in to comment.