FEATURE: Update upload security status on post move, topic conversion, category change (#8731)

Add TopicUploadSecurityManager to handle post moves. When a post moves around or a topic changes between categories and public/private message status the uploads connected to posts in the topic need to have their secure status updated, depending on the security context the topic now lives in.
This commit is contained in:
Martin Brennan
2020-01-23 12:01:10 +10:00
committed by GitHub
parent e85f4f6cc8
commit 1b3b0708c0
11 changed files with 328 additions and 6 deletions

View File

@@ -235,8 +235,11 @@ class Upload < ActiveRecord::Base
return false if self.for_theme || self.for_site_setting
mark_secure = secure_override_value.nil? ? UploadSecurity.new(self).should_be_secure? : secure_override_value
secure_status_did_change = self.secure? != mark_secure
self.update_column("secure", mark_secure)
Discourse.store.update_upload_ACL(self) if Discourse.store.external?
secure_status_did_change
end
def self.migrate_to_new_scheme(limit: nil)