mirror of
https://github.com/discourse/discourse.git
synced 2025-05-31 05:48:23 +08:00
PERF: Release post_upload records when downloaded image is removed (#10379)
Previously we would unconditionally keep all images downloaded via pull_hotlinked_images, even if they are later removed from the post. This commit removes that logic, and relies on the existing link_post_uploads process to pick up the downloaded images in `cooked`. Specs are added to ensure this is working correctly for regular hotlinked images, and for oneboxes.
This commit is contained in:
@ -915,7 +915,6 @@ class Post < ActiveRecord::Base
|
||||
upload_ids << upload.id if upload.present?
|
||||
end
|
||||
|
||||
upload_ids |= Upload.where(id: downloaded_images.values).pluck(:id)
|
||||
post_uploads = upload_ids.map do |upload_id|
|
||||
{ post_id: self.id, upload_id: upload_id }
|
||||
end
|
||||
|
Reference in New Issue
Block a user