diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2017-12-08 09:09:06 +0000 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2018-02-28 20:45:07 +0100 |
commit | 87f11d2cf539d9539b439b54355f0dadaf4ebf76 (patch) | |
tree | 389f5bb28aabfe6a189795fa91611318bb272101 /app/models/lfs_object.rb | |
parent | 6ca02a41500790b3e9061dd8836540955b9aaf7c (diff) | |
download | gitlab-ce-87f11d2cf539d9539b439b54355f0dadaf4ebf76.tar.gz |
Merge branch 'zj-auto-upload-job-artifacts' into 'master'
Transfer job archives after creation
See merge request gitlab-org/gitlab-ee!3646
Diffstat (limited to 'app/models/lfs_object.rb')
-rw-r--r-- | app/models/lfs_object.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/app/models/lfs_object.rb b/app/models/lfs_object.rb index 38b8c41024a..6ad792aab30 100644 --- a/app/models/lfs_object.rb +++ b/app/models/lfs_object.rb @@ -1,4 +1,7 @@ class LfsObject < ActiveRecord::Base + prepend EE::LfsObject + include AfterCommitQueue + has_many :lfs_objects_projects, dependent: :destroy # rubocop:disable Cop/ActiveRecordDependent has_many :projects, through: :lfs_objects_projects @@ -8,6 +11,12 @@ class LfsObject < ActiveRecord::Base mount_uploader :file, LfsObjectUploader + after_save if: :file_changed?, on: [:create, :update] do + run_after_commit do + file.schedule_migration_to_object_storage + end + end + def project_allowed_access?(project) projects.exists?(project.lfs_storage_project.id) end |