FIX: Restore the ability to rebake posts in deleted topics (#9951)

Lost in #9852
This commit is contained in:
Jarek Radosz 2020-06-01 07:04:16 +02:00 committed by GitHub
parent 2c3ff3e524
commit 00aab49829
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View File

@ -651,7 +651,7 @@ class Post < ActiveRecord::Base
)
if is_first_post?
topic.update_excerpt(excerpt_for_topic)
topic&.update_excerpt(excerpt_for_topic)
end
if invalidate_broken_images

View File

@ -1214,6 +1214,13 @@ describe Post do
post.topic.reload
expect(post.topic.excerpt).to eq("test")
end
it "works with posts in deleted topics" do
post = create_post
post.topic.trash!
post.reload
post.rebake!
end
end
describe "#set_owner" do