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:
Diffstat (limited to 'lib/api/helpers/packages_helpers.rb')
-rw-r--r--lib/api/helpers/packages_helpers.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/api/helpers/packages_helpers.rb b/lib/api/helpers/packages_helpers.rb
index 2221eec0f82..687c8330cc8 100644
--- a/lib/api/helpers/packages_helpers.rb
+++ b/lib/api/helpers/packages_helpers.rb
@@ -14,7 +14,7 @@ module API
end
def authorize_read_package!(subject = user_project)
- authorize!(:read_package, subject)
+ authorize!(:read_package, subject.try(:packages_policy_subject) || subject)
end
def authorize_create_package!(subject = user_project)
@@ -53,6 +53,11 @@ module API
category = args.delete(:category) || self.options[:for].name
::Gitlab::Tracking.event(category, event_name.to_s, **args)
end
+
+ def present_package_file!(package_file, supports_direct_download: true)
+ package_file.package.touch_last_downloaded_at
+ present_carrierwave_file!(package_file.file, supports_direct_download: supports_direct_download)
+ end
end
end
end