FIX: Missing pending queued posts from topic view (#22838)

A previous change updated `ReviewableQueuedPost`'s `created_by`
to be consistent with other reviewable types. It assigns
the the creator of the post being queued to `target_created_by` and sets
the `created_by` to the creator of the reviewable itself.

This fix updates some of the `created_by` references missed during the
intial fix.
This commit is contained in:
Selase Krakani
2023-07-28 16:16:23 +00:00
committed by GitHub
parent 3bee2a41f4
commit 81cf481b16
7 changed files with 23 additions and 10 deletions

View File

@ -547,7 +547,7 @@ RSpec.describe User do
fab!(:posts) { [post1, post2, post3] }
fab!(:post_ids) { [post1.id, post2.id, post3.id] }
let(:guardian) { Guardian.new(Fabricate(:admin)) }
fab!(:reviewable_queued_post) { Fabricate(:reviewable_queued_post, created_by: user) }
fab!(:reviewable_queued_post) { Fabricate(:reviewable_queued_post, target_created_by: user) }
it "deletes only one batch of posts" do
post2
@ -1981,13 +1981,21 @@ RSpec.describe User do
describe "#number_of_rejected_posts" do
it "counts rejected posts" do
Fabricate(:reviewable_queued_post, created_by: user, status: Reviewable.statuses[:rejected])
Fabricate(
:reviewable_queued_post,
target_created_by: user,
status: Reviewable.statuses[:rejected],
)
expect(user.number_of_rejected_posts).to eq(1)
end
it "ignore non-rejected posts" do
Fabricate(:reviewable_queued_post, created_by: user, status: Reviewable.statuses[:approved])
Fabricate(
:reviewable_queued_post,
target_created_by: user,
status: Reviewable.statuses[:approved],
)
expect(user.number_of_rejected_posts).to eq(0)
end