FIX: Allow us to serialize reviewables with deleted topics
This commit is contained in:
parent
02d8931425
commit
af04318aff
|
@ -93,7 +93,7 @@ class ReviewableSerializer < ApplicationSerializer
|
|||
end
|
||||
|
||||
def include_topic_url?
|
||||
object.topic_id.present?
|
||||
object.topic.present?
|
||||
end
|
||||
|
||||
def include_topic_id?
|
||||
|
|
|
@ -13,4 +13,13 @@ describe ReviewableFlaggedPostSerializer do
|
|||
expect(json[:topic_url]).to eq(p0.url)
|
||||
end
|
||||
|
||||
it "works when the topic is deleted" do
|
||||
reviewable = Fabricate(:reviewable_queued_post)
|
||||
reviewable.topic.update(deleted_at: Time.now)
|
||||
reviewable.reload
|
||||
|
||||
json = ReviewableQueuedPostSerializer.new(reviewable, scope: Guardian.new(admin), root: nil).as_json
|
||||
expect(json[:id]).to be_present
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue