diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-23 15:08:46 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-23 15:08:46 +0000 |
commit | 3f9e1b261121f4dbd045341241f81b47356c99cf (patch) | |
tree | 32be23bd7fda0c3f891182f220f6d0399a1b41dd /lib/gitlab/application_context.rb | |
parent | 5ad0cf26551baff8f08af8562a8d45e6ec14d71a (diff) | |
download | gitlab-ce-3f9e1b261121f4dbd045341241f81b47356c99cf.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/application_context.rb')
-rw-r--r-- | lib/gitlab/application_context.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/gitlab/application_context.rb b/lib/gitlab/application_context.rb index 71dbfea70e8..5a9a99423c4 100644 --- a/lib/gitlab/application_context.rb +++ b/lib/gitlab/application_context.rb @@ -5,12 +5,13 @@ module Gitlab class ApplicationContext include Gitlab::Utils::LazyAttributes - Attribute = Struct.new(:name, :type) + Attribute = Struct.new(:name, :type, :evaluation) APPLICATION_ATTRIBUTES = [ Attribute.new(:project, Project), Attribute.new(:namespace, Namespace), - Attribute.new(:user, User) + Attribute.new(:user, User), + Attribute.new(:caller_id, String) ].freeze def self.with_context(args, &block) @@ -37,6 +38,7 @@ module Gitlab hash[:user] = -> { username } if set_values.include?(:user) hash[:project] = -> { project_path } if set_values.include?(:project) hash[:root_namespace] = -> { root_namespace_path } if include_namespace? + hash[:caller_id] = caller_id if set_values.include?(:caller_id) end end @@ -75,3 +77,5 @@ module Gitlab end end end + +Gitlab::ApplicationContext.prepend_if_ee('EE::Gitlab::ApplicationContext') |