From b56027c9d80ac0e297ba8a43c81e8504172dbf9f Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Tue, 7 Apr 2020 00:09:33 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- lib/gitlab/git_access_snippet.rb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'lib/gitlab/git_access_snippet.rb') diff --git a/lib/gitlab/git_access_snippet.rb b/lib/gitlab/git_access_snippet.rb index e11c1ea527c..d05ffe9b508 100644 --- a/lib/gitlab/git_access_snippet.rb +++ b/lib/gitlab/git_access_snippet.rb @@ -14,6 +14,8 @@ module Gitlab attr_reader :snippet + alias_method :container, :snippet + def initialize(actor, snippet, protocol, **kwargs) @snippet = snippet @@ -53,11 +55,6 @@ module Gitlab check_change_access! end - override :repository - def repository - snippet&.repository - end - def check_snippet_accessibility! if snippet.blank? raise NotFoundError, ERROR_MESSAGES[:snippet_not_found] @@ -89,11 +86,15 @@ module Gitlab raise ForbiddenError, ERROR_MESSAGES[:update_snippet] end + check_size_before_push! + changes_list.each do |change| # If user does not have access to make at least one change, cancel all # push by allowing the exception to bubble up check_single_change_access(change) end + + check_push_size! end def check_single_change_access(change) -- cgit v1.2.3