Work around deleted upload.access_control_post scoping issue

* TODO to come back and deal with this in a better way, it
  just needs to be done for the rake task to set secure media
  to work correctly
This commit is contained in:
Martin Brennan 2020-02-20 10:57:40 +10:00
parent 97d8f19387
commit 5dc6100acc

View File

@ -60,6 +60,9 @@ class UploadSecurity
# if there is no access control post id and the upload is currently secure, we
# do not want to make it un-secure to avoid unintentionally exposing it
def access_control_post_has_secure_media?
# if the post is deleted the access_control_post will be blank...
# TODO: deal with this in a better way
return false if @upload.access_control_post.blank?
@upload.access_control_post.with_secure_media?
end