Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-04-14 18:09:44 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-14 18:09:44 +0300
commit874ead9c3a50de4c4ca4551eaf5b7eb976d26b50 (patch)
tree637ee9f2da5e251bc08ebf3e972209d51966bf7c /app/uploaders
parent2e4c4055181eec9186458dd5dd3219c937032ec7 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/uploaders')
-rw-r--r--app/uploaders/records_uploads.rb23
1 files changed, 22 insertions, 1 deletions
diff --git a/app/uploaders/records_uploads.rb b/app/uploaders/records_uploads.rb
index 967fcdc704e..427314a87bb 100644
--- a/app/uploaders/records_uploads.rb
+++ b/app/uploaders/records_uploads.rb
@@ -56,10 +56,31 @@ module RecordsUploads
size: file.size,
path: upload_path,
model: model,
- mount_point: mounted_as
+ mount_point: mounted_as,
+ store: initial_store
)
end
+ def initial_store
+ if immediately_remote_stored?
+ ::ObjectStorage::Store::REMOTE
+ else
+ ::ObjectStorage::Store::LOCAL
+ end
+ end
+
+ def immediately_remote_stored?
+ object_storage_available? && direct_upload_enabled?
+ end
+
+ def object_storage_available?
+ self.class.ancestors.include?(ObjectStorage::Concern)
+ end
+
+ def direct_upload_enabled?
+ self.class.object_store_enabled? && self.class.direct_upload_enabled?
+ end
+
# Before removing an attachment, destroy any Upload records at the same path
#
# Called `before :remove`