FIX: Don't raise on deleted topic in UpdateHotlinkedRaw (#17901)

Fixes:

```
Job exception: undefined method `acting_user=' for nil:NilClass
```

in
```
/var/www/discourse/lib/post_revisor.rb:181:in `revise!'
/var/www/discourse/app/models/post.rb:646:in `revise'
/var/www/discourse/app/jobs/regular/update_hotlinked_raw.rb:24:in `execute'
```
This commit is contained in:
Jarek Radosz 2022-08-13 22:40:26 +02:00 committed by GitHub
parent 0cbdbe3be9
commit 2361833844
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 0 deletions

View File

@ -11,6 +11,7 @@ module Jobs
post = Post.find_by(id: @post_id) post = Post.find_by(id: @post_id)
return if post.nil? return if post.nil?
return if post.cook_method == Post.cook_methods[:raw_html] return if post.cook_method == Post.cook_methods[:raw_html]
return if post.topic.nil?
hotlinked_map = post.post_hotlinked_media.preload(:upload).map { |r| [r.url, r] }.to_h hotlinked_map = post.post_hotlinked_media.preload(:upload).map { |r| [r.url, r] }.to_h