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:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-02-09 15:11:06 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-02-09 15:11:06 +0300
commit6180f62ab34662c64103872b8352b25817b73a8d (patch)
tree2d7f30b845726fb0bff9ee191c11996c04c22c2c /lib/gitlab/cache
parent2e2db606cc7547b445a11c367d8db6f5feb42443 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/cache')
-rw-r--r--lib/gitlab/cache/helpers.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/gitlab/cache/helpers.rb b/lib/gitlab/cache/helpers.rb
index 024fa48c066..0fc0b1504af 100644
--- a/lib/gitlab/cache/helpers.rb
+++ b/lib/gitlab/cache/helpers.rb
@@ -45,7 +45,14 @@ module Gitlab
def contextual_cache_key(presenter, object, context)
return object.cache_key if context.nil?
- [presenter.class.name, object.cache_key, context.call(object)].flatten.join(":")
+ [presenter_class_name(presenter), object.cache_key, context.call(object)].flatten.join(":")
+ end
+
+ def presenter_class_name(presenter)
+ return presenter.class.name if presenter.is_a?(BaseSerializer)
+ return presenter.name if presenter.is_a?(Class) && presenter < Grape::Entity
+
+ raise ArgumentError, "presenter #{presenter} is not supported"
end
# Used for fetching or rendering a single object