diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-18 03:08:09 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-18 03:08:09 +0300 |
commit | 2a65a97e12a0754b9f0d91ee996a6e61e00c80c8 (patch) | |
tree | f439c93cc95a324ba7422b0b650431a628be9b07 /lib/gitlab/utils | |
parent | 2d96e61ceb1a3f26283dfba43f85d99488752296 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/utils')
-rw-r--r-- | lib/gitlab/utils/override.rb | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/gitlab/utils/override.rb b/lib/gitlab/utils/override.rb index 35aea209cb9..784a6686962 100644 --- a/lib/gitlab/utils/override.rb +++ b/lib/gitlab/utils/override.rb @@ -146,7 +146,8 @@ module Gitlab def prepended(base = nil) super - queue_verification(base) if base + # prepend can override methods, thus we need to verify it like classes + queue_verification(base, verify: true) if base end def extended(mod = nil) @@ -155,11 +156,15 @@ module Gitlab queue_verification(mod.singleton_class) if mod end - def queue_verification(base) + def queue_verification(base, verify: false) return unless ENV['STATIC_VERIFICATION'] - if base.is_a?(Class) # We could check for Class in `override` - # This could be `nil` if `override` was never called + # We could check for Class in `override` + # This could be `nil` if `override` was never called. + # We also force verification for prepend because it can also override + # a method like a class, but not the cases for include or extend. + # This includes Rails helpers but not limited to. + if base.is_a?(Class) || verify Override.extensions[self]&.add_class(base) end end |