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

@@ -459,7 +459,7 @@ module Jobs
# Most Reviewable fields staff-private, but post content needs to be exported.
ReviewableQueuedPost
.where(created_by: @current_user.id)
.where(target_created_by_id: @current_user.id)
.order(:created_at)
.each do |rev|
yield(

View File

@@ -101,7 +101,8 @@ class Reviewable < ActiveRecord::Base
created_by:,
payload: nil,
reviewable_by_moderator: false,
potential_spam: true
potential_spam: true,
target_created_by: nil
)
reviewable =
new(
@@ -111,6 +112,7 @@ class Reviewable < ActiveRecord::Base
reviewable_by_moderator: reviewable_by_moderator,
payload: payload,
potential_spam: potential_spam,
target_created_by: target_created_by,
)
reviewable.created_new!

View File

@@ -1543,7 +1543,7 @@ class User < ActiveRecord::Base
end
def number_of_rejected_posts
ReviewableQueuedPost.rejected.where(created_by_id: self.id).count
ReviewableQueuedPost.rejected.where(target_created_by_id: self.id).count
end
def number_of_flags_given